Skip to content

Commit

Permalink
Merge branch 'release/1.7.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
emmanuelmathot committed Feb 22, 2023
2 parents ddf1679 + 391e349 commit 68f9d9a
Show file tree
Hide file tree
Showing 21 changed files with 1,985 additions and 7 deletions.
12 changes: 12 additions & 0 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"version": 1,
"isRoot": true,
"tools": {
"dotnet-format": {
"version": "7.0.318001",
"commands": [
"dotnet-format"
]
}
}
}
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
16 changes: 14 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

## [1.7.0](https://github.com/Terradue/DotNetStac/compare/1.6.6...1.7.0)
## [1.7.1](https://github.com/Terradue/DotNetStac/compare/1.7.0...1.7.1)

Style and format improvements
### Merged

- Disasters Charter Extension + Tests [`#22`](https://github.com/Terradue/DotNetStac/pull/22)

### Commits

- More Tests [`ed4bbb7`](https://github.com/Terradue/DotNetStac/commit/ed4bbb7d9bb45011c7d6210a2727785d533f10d3)
- styling compliance [`25d4517`](https://github.com/Terradue/DotNetStac/commit/25d4517c53a84aca6099a3a77c9f2a4a9f3c8693)
- linting [`a81375c`](https://github.com/Terradue/DotNetStac/commit/a81375c83b2627ab56a9eb8e2aa5d3f5c6e98bb9)
- LazyEnumParse tests [`472b163`](https://github.com/Terradue/DotNetStac/commit/472b1639fb3decd4d4e8693345ad2264f95eb03b)
- linting [`608c7da`](https://github.com/Terradue/DotNetStac/commit/608c7dabccec2e11252f61e08807a9b1498572df)

## [1.7.0](https://github.com/Terradue/DotNetStac/compare/1.6.6...1.7.0) - 2023-02-08

### Merged

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@

<h3 align="center">

![Build Status](https://github.com/Terradue/DotNetStac/actions/workflows/build.yaml/badge.svg?branch=release/1.7.0)
![Build Status](https://github.com/Terradue/DotNetStac/actions/workflows/build.yaml/badge.svg?branch=release/1.7.1)
[![NuGet](https://img.shields.io/nuget/vpre/DotNetStac)](https://www.nuget.org/packages/DotNetStac/)
[![codecov](https://codecov.io/gh/Terradue/DotNetStac/branch/release/1.7.0/graph/badge.svg)](https://codecov.io/gh/Terradue/DotNetStac)
[![codecov](https://codecov.io/gh/Terradue/DotNetStac/branch/release/1.7.1/graph/badge.svg)](https://codecov.io/gh/Terradue/DotNetStac)
[![Gitter](https://img.shields.io/gitter/room/SpatioTemporal-Asset-Catalog/Lobby?color=yellow)](https://gitter.im/SpatioTemporal-Asset-Catalog/Lobby)
[![License](https://img.shields.io/badge/license-AGPL3-blue.svg)](LICENSE)
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/Terradue/DotNetStac/master?filepath=example.ipynb)
Expand Down
34 changes: 34 additions & 0 deletions src/DotNetStac.Test/Common/Enum/Enum.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// Copyright (c) by Terradue Srl. All Rights Reserved.
// License under the AGPL, Version 3.0.
// File Name: Enum.cs

using System.Runtime.Serialization;
using Newtonsoft.Json;

namespace Stac.Test.Common
{
public enum Enum1
{
test,

summary
}

public enum Enum2
{
[JsonProperty("test")]
Test,

[JsonProperty("summary")]
Summary
}

public enum Enum3
{
[EnumMember(Value = @"cql2-text")]
Cql2Text,

[EnumMember(Value = @"cql2-json")]
Cql2Json
}
}
17 changes: 16 additions & 1 deletion src/DotNetStac.Test/Common/StacAccessorsHelpersTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
using Stac.Common;
using Xunit;

namespace Stac.Test.Item
namespace Stac.Test.Common
{
public class StacAccessorsHelpersTests : TestBase
{
Expand Down Expand Up @@ -73,5 +73,20 @@ public void GetPropertyTest()
Assert.Equal(summaryItemType, item.GetProperty<SummaryItemType>("summary"));

}

[Fact]
public void LazyEnumParseTests()
{
Enum1 test = Enum1.test;
Assert.Equal(test, StacAccessorsHelpers.LazyEnumParse(typeof(Enum1), "test"));

Enum2 test2 = Enum2.Test;
Assert.Equal(test2, StacAccessorsHelpers.LazyEnumParse(typeof(Enum2), "test"));

Enum3 test3 = Enum3.Cql2Json;
Assert.Equal(test3, StacAccessorsHelpers.LazyEnumParse(typeof(Enum3), "cql2-json"));

Assert.Equal(test3, StacAccessorsHelpers.LazyEnumParse(typeof(Enum3), "Cql2Json"));
}
}
}
109 changes: 109 additions & 0 deletions src/DotNetStac.Test/Extensions/DisastersCharterExtensionTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
// Copyright (c) by Terradue Srl. All Rights Reserved.
// License under the AGPL, Version 3.0.
// File Name: DisastersCharterExtensionTests.cs

using System;
using System.Linq;
using Stac.Collection;
using Stac.Extensions.Disaster;
using Xunit;

namespace Stac.Test.Extensions
{
public class DisastersCharterExtensionTests : TestBase
{
[Fact]
public void ActivationTest()
{
var json = GetJson("Extensions");

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

Assert.IsType<StacItem>(item);
Assert.Equal(DisastersItemClass.Activation, item.DisasterExtension().Class);
Assert.Equal(744, item.DisasterExtension().ActivationId);
Assert.Equal(855, item.DisasterExtension().CallIds.First());
Assert.Equal(new DisastersType[2] { DisastersType.Other, DisastersType.Volcano }, item.DisasterExtension().Types);
Assert.Equal("TON", item.DisasterExtension().Country);
Assert.Equal(new string[1] { "Tonga" }, item.DisasterExtension().Regions);
Assert.Equal(DisastersActivationStatus.Open, item.DisasterExtension().ActivationStatus);
}

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

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

Assert.IsType<StacItem>(item);
Assert.Equal(DisastersItemClass.Area, item.DisasterExtension().Class);
Assert.Equal(744, item.DisasterExtension().ActivationId);
Assert.Equal(855, item.DisasterExtension().CallIds.First());
Assert.Equal(new DisastersType[2] { DisastersType.Other, DisastersType.Volcano }, item.DisasterExtension().Types);
Assert.Equal("TON", item.DisasterExtension().Country);
Assert.Equal(new string[1] { "Tonga" }, item.DisasterExtension().Regions);
}

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

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

Assert.IsType<StacItem>(item);
Assert.Equal(DisastersItemClass.Acquisition, item.DisasterExtension().Class);
Assert.Equal(855, item.DisasterExtension().CallIds.First());
Assert.Equal(DisastersResolutionClass.HR, item.DisasterExtension().ResolutionClass);
}

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

var collection = StacConvert.Deserialize<StacCollection>(json);

Assert.IsType<StacCollection>(collection);
Assert.Equal(DisastersItemClass.Acquisition, collection.DisasterExtension().Class);
Assert.Equal(855, collection.DisasterExtension().CallIds.First());
StacSummaryValueSet<string> resolutionClassSummary = collection.Summaries
.FirstOrDefault(k => k.Key == DisastersCharterStacExtension.ResolutionClassField).Value as StacSummaryValueSet<string>;

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 68f9d9a

Please sign in to comment.