Skip to content

Commit

Permalink
More Tests
Browse files Browse the repository at this point in the history
  • Loading branch information
emmanuelmathot committed Feb 8, 2023
1 parent 25d4517 commit ed4bbb7
Show file tree
Hide file tree
Showing 5 changed files with 448 additions and 0 deletions.
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"dotnet-test-explorer.testProjectPath": "**/*Test.@(csproj|vbproj|fsproj)",
"coverage-gutters.coverageFileNames": ["TestResults/**/coverage.cobertura.xml"],
"python.pythonPath": "/bin/python3",
"psi-header.variables": [
["projectCreationYear", "2020"]
Expand Down
32 changes: 32 additions & 0 deletions src/DotNetStac.Test/Extensions/DisastersCharterExtensionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// License under the AGPL, Version 3.0.
// File Name: DisastersCharterExtensionTests.cs

using System;
using System.Linq;
using Stac.Collection;
using Stac.Extensions.Disaster;
Expand Down Expand Up @@ -73,5 +74,36 @@ public void CallCollectionTest()
Assert.Contains(DisastersResolutionClass.HR.ToString(), resolutionClassSummary);
}

[Fact]
public void PropertiesTest()
{
var json = GetJson("Extensions");

var item = StacConvert.Deserialize<StacItem>(json);

Assert.IsType<StacItem>(item);
Assert.Throws<ArgumentException>(() => item.DisasterExtension().Country = "Belgium");
item.DisasterExtension().Country = "BEL";
Assert.Equal("BEL", item.DisasterExtension().Country);
item.DisasterExtension().ActivationId = 123;
Assert.Equal(123, item.DisasterExtension().ActivationId);
item.DisasterExtension().CallIds = new int[2] { 123, 456 };
Assert.Equal(123, item.DisasterExtension().CallIds.First());
Assert.Equal(456, item.DisasterExtension().CallIds.Last());
item.DisasterExtension().Regions = new string[3] { "Belgium", "Wallonie", "Namur" };
Assert.Equal("Belgium", item.DisasterExtension().Regions.First());
Assert.Equal("Namur", item.DisasterExtension().Regions.Last());
item.DisasterExtension().Types = new DisastersType[3] { DisastersType.Earthquake, DisastersType.FloodFlash, DisastersType.Other };
Assert.Equal(DisastersType.Earthquake, item.DisasterExtension().Types.First());
Assert.Equal(DisastersType.Other, item.DisasterExtension().Types.Last());
item.DisasterExtension().ActivationStatus = DisastersActivationStatus.Closed;
Assert.Equal(DisastersActivationStatus.Closed, item.DisasterExtension().ActivationStatus);
item.DisasterExtension().ResolutionClass = DisastersResolutionClass.HR;
Assert.Equal(DisastersResolutionClass.HR, item.DisasterExtension().ResolutionClass);



}

}
}
Loading

0 comments on commit ed4bbb7

Please sign in to comment.