Skip to content

Commit

Permalink
Merge branch 'release/v2.9.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
jtellnes committed Feb 13, 2023
2 parents 1a04a53 + a15ece9 commit ac67a59
Show file tree
Hide file tree
Showing 87 changed files with 3,290 additions and 794 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="FluentAssertions" Version="6.8.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.2" />
<PackageReference Include="FluentAssertions" Version="6.10.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.1" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<PrivateAssets>all</PrivateAssets>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="FluentAssertions" Version="6.8.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.2" />
<PackageReference Include="Moq" Version="4.18.2" />
<PackageReference Include="FluentAssertions" Version="6.10.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.1" />
<PackageReference Include="Moq" Version="4.18.4" />
<PackageReference Include="Serilog.Sinks.Observable" Version="2.0.2" />
<PackageReference Include="SharpZipLib" Version="1.3.3" />
<PackageReference Include="SharpZipLib" Version="1.4.2" />
<PackageReference Include="System.Reactive" Version="5.0.0" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,28 +80,28 @@ public void ShouldThrowExceptionIfTrueAndFalseAreEqual()
public void IsNullShouldReturnTrueIfStringIsEqualToNullValue()
{
BooleanDataType type = new BooleanDataType("T/F", new List<string> {"null", ""});
type.IsNull("null").Should().BeTrue();
type.IsNull("").Should().BeTrue();
type.IsValidNullValue("null").Should().BeTrue();
type.IsValidNullValue("").Should().BeTrue();
}

[Fact]
public void IsNullShouldReturnFalseIfStringIsNotEqualToNullValue()
{
BooleanDataType type = new BooleanDataType("T/F", new List<string> { "null", "" });
type.IsNull("T").Should().BeFalse();
type.IsNull("F").Should().BeFalse();
type.IsNull("other").Should().BeFalse();
type.IsValidNullValue("T").Should().BeFalse();
type.IsValidNullValue("F").Should().BeFalse();
type.IsValidNullValue("other").Should().BeFalse();
}

[Fact]
public void IsNullShouldReturnFalseIfNullValueIsNotSet()
{
BooleanDataType type = new BooleanDataType("T/F", null);
type.IsNull("null").Should().BeFalse();
type.IsNull("").Should().BeFalse();
type.IsNull("T").Should().BeFalse();
type.IsNull("F").Should().BeFalse();
type.IsNull("other").Should().BeFalse();
type.IsValidNullValue("null").Should().BeFalse();
type.IsValidNullValue("").Should().BeFalse();
type.IsValidNullValue("T").Should().BeFalse();
type.IsValidNullValue("F").Should().BeFalse();
type.IsValidNullValue("other").Should().BeFalse();
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ public class DateDataTypeTest
[Fact]
public void IsValidShouldReturnTrueIfDateIsValid()
{
new DateDataType("dd.MM.yyyyTHH:mm:sszzz", null).IsValid("18.11.2016T08:43:00+00:00").Should().BeTrue();
new DateDataType("dd.MM.yyyyTHH:mm:sszzz", null).IsValid("18.11.2016T08:43:00+00:00", true).Should().BeTrue();
}

[Fact]
public void IsValidShouldReturnFalseIfDateIsInvalid()
{
new DateDataType("dd.MM.yyyyTHH:mm:sszzz", null).IsValid("99.11.2016T08:43:00+00:00").Should().BeFalse();
new DateDataType("not-a-date").IsValid("also not a date").Should().BeFalse();
new DateDataType("YYYY-MM-DD\"T\"hh\":\"mm\":\"ss\"Z\"").IsValid("2001-01-01-T10:10:10Z").Should().BeFalse();
new DateDataType("YYYY-MM-DD\"T\"hh\":\"mm\":\"ss\"Z\"").IsValid("åpenbar feil").Should().BeFalse();
new DateDataType("YYYY-DDD").IsValid("2022--200-").Should().BeFalse();
new DateDataType("dd.MM.yyyyTHH:mm:sszzz", null).IsValid("99.11.2016T08:43:00+00:00", true).Should().BeFalse();
new DateDataType("not-a-date").IsValid("also not a date", true).Should().BeFalse();
new DateDataType("YYYY-MM-DD\"T\"hh\":\"mm\":\"ss\"Z\"").IsValid("2001-01-01-T10:10:10Z", true).Should().BeFalse();
new DateDataType("YYYY-MM-DD\"T\"hh\":\"mm\":\"ss\"Z\"").IsValid("åpenbar feil", true).Should().BeFalse();
new DateDataType("YYYY-DDD").IsValid("2022--200-", true).Should().BeFalse();
}

[Fact]
Expand Down Expand Up @@ -103,39 +103,80 @@ public void NS_ISO_8601FormatsShouldBeValid()
{
//Calendar dates
//Basic representations
new DateDataType("YYYYMMDD").IsValid("20200101").Should().BeTrue();
new DateDataType("YYYYMMDD\"T\"hhmmss\"Z\"").IsValid("20200101T010203Z").Should().BeTrue();
new DateDataType("YYYYMMDD\"T\"hhmmss±hh").IsValid("20200101T010203+01").Should().BeTrue();
new DateDataType("YYYYMMDD\"T\"hhmmss±hhmm").IsValid("20200101T010203+0100").Should().BeTrue();
new DateDataType("YYYYMMDD").IsValid("20200101", true).Should().BeTrue();
new DateDataType("YYYYMMDD\"T\"hhmmss\"Z\"").IsValid("20200101T010203Z", true).Should().BeTrue();
new DateDataType("YYYYMMDD\"T\"hhmmss±hh").IsValid("20200101T010203+01", true).Should().BeTrue();
new DateDataType("YYYYMMDD\"T\"hhmmss±hhmm").IsValid("20200101T010203+0100", true).Should().BeTrue();
//Extended representations
new DateDataType("YYYY-MM-DD").IsValid("2020-01-01").Should().BeTrue();
new DateDataType("YYYY-MM-DD\"T\"hh\":\"mm\":\"ss\"Z\"").IsValid("2020-01-01T01:02:03Z").Should().BeTrue();
new DateDataType("YYYY-MM-DD\"T\"hh\":\"mm\":\"ss±hh").IsValid("2020-01-01T01:02:03+01").Should().BeTrue();
new DateDataType("YYYY-MM-DD\"T\"hh\":\"mm\":\"ss±hh\":\"mm").IsValid("2020-01-01T01:02:03+01:00").Should().BeTrue();
new DateDataType("YYYY-MM-DD").IsValid("2020-01-01", true).Should().BeTrue();
new DateDataType("YYYY-MM-DD\"T\"hh\":\"mm\":\"ss\"Z\"").IsValid("2020-01-01T01:02:03Z", true).Should().BeTrue();
new DateDataType("YYYY-MM-DD\"T\"hh\":\"mm\":\"ss±hh").IsValid("2020-01-01T01:02:03+01", true).Should().BeTrue();
new DateDataType("YYYY-MM-DD\"T\"hh\":\"mm\":\"ss±hh\":\"mm").IsValid("2020-01-01T01:02:03+01:00", true).Should().BeTrue();

//Ordinal dates
//Basic representations
new DateDataType("YYYYDDD").IsValid("2022076").Should().BeTrue();
new DateDataType("YYYYDDD\"T\"hhmmss\"Z\"").IsValid("2022076T092800Z").Should().BeTrue();
new DateDataType("YYYYDDD\"T\"hhmmss±hh").IsValid("2022076T092800+01").Should().BeTrue();
new DateDataType("YYYYDDD\"T\"hhmmss±hhmm").IsValid("2022076T092800+0100").Should().BeTrue();
new DateDataType("YYYYDDD").IsValid("2022076", true).Should().BeTrue();
new DateDataType("YYYYDDD\"T\"hhmmss\"Z\"").IsValid("2022076T092800Z", true).Should().BeTrue();
new DateDataType("YYYYDDD\"T\"hhmmss±hh").IsValid("2022076T092800+01", true).Should().BeTrue();
new DateDataType("YYYYDDD\"T\"hhmmss±hhmm").IsValid("2022076T092800+0100", true).Should().BeTrue();
//Extended representations
new DateDataType("YYYY-DDD").IsValid("2024-366").Should().BeTrue();
new DateDataType("YYYY-DDD\"T\"hh\":\"mm\":\"ss\"Z\"").IsValid("2024-366T09:28:00Z").Should().BeTrue();
new DateDataType("YYYY-DDD\"T\"hh\":\"mm\":\"ss±hh").IsValid("2024-366T09:28:00+01").Should().BeTrue();
new DateDataType("YYYY-DDD\"T\"hh\":\"mm\":\"ss±hh\":\"mm").IsValid("2024-366T09:28:00+01:00").Should().BeTrue();
new DateDataType("YYYY-DDD").IsValid("2024-366", true).Should().BeTrue();
new DateDataType("YYYY-DDD\"T\"hh\":\"mm\":\"ss\"Z\"").IsValid("2024-366T09:28:00Z", true).Should().BeTrue();
new DateDataType("YYYY-DDD\"T\"hh\":\"mm\":\"ss±hh").IsValid("2024-366T09:28:00+01", true).Should().BeTrue();
new DateDataType("YYYY-DDD\"T\"hh\":\"mm\":\"ss±hh\":\"mm").IsValid("2024-366T09:28:00+01:00", true).Should().BeTrue();

//Week dates
//Basic representations
new DateDataType("YYYY\"W\"WWD").IsValid("2022W011").Should().BeTrue();
new DateDataType("YYYY\"W\"WWD\"T\"hhmmss\"Z\"").IsValid("2022W011T010203Z").Should().BeTrue();
new DateDataType("YYYY\"W\"WWD\"T\"hhmmss±hh").IsValid("2022W011T010203+01").Should().BeTrue();
new DateDataType("YYYY\"W\"WWD\"T\"hhmmss±hhmm").IsValid("2022W011T010203+0100").Should().BeTrue();
new DateDataType("YYYY\"W\"WWD").IsValid("2022W011", true).Should().BeTrue();
new DateDataType("YYYY\"W\"WWD\"T\"hhmmss\"Z\"").IsValid("2022W011T010203Z", true).Should().BeTrue();
new DateDataType("YYYY\"W\"WWD\"T\"hhmmss±hh").IsValid("2022W011T010203+01", true).Should().BeTrue();
new DateDataType("YYYY\"W\"WWD\"T\"hhmmss±hhmm").IsValid("2022W011T010203+0100", true).Should().BeTrue();
//Extended representations
new DateDataType("YYYY-\"W\"WW-D").IsValid("2022-W52-7").Should().BeTrue();
new DateDataType("YYYY-\"W\"WW-D\"T\"hh\":\"mm\":\"ss\"Z\"").IsValid("2022-W52-7T01:02:03Z").Should().BeTrue();
new DateDataType("YYYY-\"W\"WW-D\"T\"hh\":\"mm\":\"ss±hh").IsValid("2022-W52-7T01:02:03+01").Should().BeTrue();
new DateDataType("YYYY-\"W\"WW-D\"T\"hh\":\"mm\":\"ss±hh\":\"mm").IsValid("2022-W52-7T01:02:03+01:00").Should().BeTrue();
new DateDataType("YYYY-\"W\"WW-D").IsValid("2022-W52-7", true).Should().BeTrue();
new DateDataType("YYYY-\"W\"WW-D\"T\"hh\":\"mm\":\"ss\"Z\"").IsValid("2022-W52-7T01:02:03Z", true).Should().BeTrue();
new DateDataType("YYYY-\"W\"WW-D\"T\"hh\":\"mm\":\"ss±hh").IsValid("2022-W52-7T01:02:03+01", true).Should().BeTrue();
new DateDataType("YYYY-\"W\"WW-D\"T\"hh\":\"mm\":\"ss±hh\":\"mm").IsValid("2022-W52-7T01:02:03+01:00", true).Should().BeTrue();
}


[Fact]
public void NS_ISO_8601FormatsShouldBeInvalid()
{
//Calendar dates
//Basic representations
new DateDataType("YYYYMMDD").IsValid("20201301", true).Should().BeFalse();
new DateDataType("YYYYMMDD\"T\"hhmmss\"Z\"").IsValid("20201301T010203Z", true).Should().BeFalse();
new DateDataType("YYYYMMDD\"T\"hhmmss±hh").IsValid("20200001T010203+01", true).Should().BeFalse();
new DateDataType("YYYYMMDD\"T\"hhmmss±hhmm").IsValid("20200001T010203+0100", true).Should().BeFalse();
//Extended representations
new DateDataType("YYYY-MM-DD").IsValid("2020-13-01", true).Should().BeFalse();
new DateDataType("YYYY-MM-DD\"T\"hh\":\"mm\":\"ss\"Z\"").IsValid("2020-13-01T01:02:03Z", true).Should().BeFalse();
new DateDataType("YYYY-MM-DD\"T\"hh\":\"mm\":\"ss±hh").IsValid("2020-00-01T01:02:03+01", true).Should().BeFalse();
new DateDataType("YYYY-MM-DD\"T\"hh\":\"mm\":\"ss±hh\":\"mm").IsValid("2020-00-01T01:02:03+01:00", true).Should().BeFalse();

//Ordinal dates
//Basic representations
new DateDataType("YYYYDDD").IsValid("2022500", true).Should().BeFalse();
new DateDataType("YYYYDDD\"T\"hhmmss\"Z\"").IsValid("2022500T092800Z", true).Should().BeFalse();
new DateDataType("YYYYDDD\"T\"hhmmss±hh").IsValid("2022500T092800+01", true).Should().BeFalse();
new DateDataType("YYYYDDD\"T\"hhmmss±hhmm").IsValid("2022500T092800+0100", true).Should().BeFalse();
//Extended representations
new DateDataType("YYYY-DDD").IsValid("2024-367", true).Should().BeFalse();
new DateDataType("YYYY-DDD\"T\"hh\":\"mm\":\"ss\"Z\"").IsValid("2024-367T09:28:00Z", true).Should().BeFalse();
new DateDataType("YYYY-DDD\"T\"hh\":\"mm\":\"ss±hh").IsValid("2024-367T09:28:00+01", true).Should().BeFalse();
new DateDataType("YYYY-DDD\"T\"hh\":\"mm\":\"ss±hh\":\"mm").IsValid("2024-367T09:28:00+01:00", true).Should().BeFalse();

//Week dates
//Basic representations
new DateDataType("YYYY\"W\"WWD").IsValid("2022W541", true).Should().BeFalse();
new DateDataType("YYYY\"W\"WWD\"T\"hhmmss\"Z\"").IsValid("2022W541T010203Z", true).Should().BeFalse();
new DateDataType("YYYY\"W\"WWD\"T\"hhmmss±hh").IsValid("2022W518T010203+01", true).Should().BeFalse();
new DateDataType("YYYY\"W\"WWD\"T\"hhmmss±hhmm").IsValid("2022W5113T010203+0100", true).Should().BeFalse();
//Extended representations
new DateDataType("YYYY-\"W\"WW-D").IsValid("2022-W54-7", true).Should().BeFalse();
new DateDataType("YYYY-\"W\"WW-D\"T\"hh\":\"mm\":\"ss\"Z\"").IsValid("2022-W54-7T01:02:03Z", true).Should().BeFalse();
new DateDataType("YYYY-\"W\"WW-D\"T\"hh\":\"mm\":\"ss±hh").IsValid("2022-W51-8T01:02:03+01", true).Should().BeFalse();
new DateDataType("YYYY-\"W\"WW-D\"T\"hh\":\"mm\":\"ss±hh\":\"mm").IsValid("2022-W51-13T01:02:03+01:00", true).Should().BeFalse();
}
}
}
Loading

0 comments on commit ac67a59

Please sign in to comment.