-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6d63b42
commit a0559c2
Showing
2 changed files
with
28 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,31 @@ | ||
using USACE.HEC.Hazards; | ||
using Xunit.Sdk; | ||
|
||
namespace ConsequencesTest; | ||
public class DepthHazardTest | ||
{ | ||
[Fact] | ||
public void Test() | ||
public void TestInterfaceImplementation() | ||
{ | ||
DepthHazard dh = new DepthHazard(1.01f); | ||
float input = 1.01f; | ||
IHazard dh = new DepthHazard(input); | ||
bool has = dh.Has(HazardParameter.Depth); | ||
float depth = dh.Get<float>(HazardParameter.Depth); | ||
if (has) | ||
{ | ||
float depth = dh.Get<float>(HazardParameter.Depth); | ||
Assert.Equal(input, depth); | ||
} else | ||
{ | ||
throw new Exception("Failed to find appropriate parameter"); | ||
} | ||
|
||
} | ||
|
||
[Fact] | ||
public void TestGetWrongParameter() | ||
{ | ||
IHazard dh = new DepthHazard(1.01f); | ||
Assert.Throws<NotSupportedException>(() => dh.Get<float>(HazardParameter.ArrivalTime)); | ||
|
||
} | ||
} |