Skip to content

Commit

Permalink
fix unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Arnaud Boussaer authored and Arnaud Boussaer committed Feb 13, 2025
1 parent da4d962 commit f887b25
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 19 deletions.
2 changes: 1 addition & 1 deletion src/OData2Linq/OData2Linq.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<SignAssembly>True</SignAssembly>
<AssemblyOriginatorKeyFile>FriendAssemblies.snk</AssemblyOriginatorKeyFile>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<Version>0.0.8</Version>
<Version>0.0.9</Version>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageReadmeFile>README.md</PackageReadmeFile>
<RepositoryUrl>https://github.com/ArnaudB88/OData2Linq</RepositoryUrl>
Expand Down
38 changes: 20 additions & 18 deletions test/OData2Linq.Tests/DateTimeFilterTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ public void LocalDateTimetNotEquaIncorrectUtcOffset()
output.WriteLine(filter);

var result = SimpleClass.CreateQuery().OData().Filter(filter).ToArray();
if (TimeZoneInfo.Local != TimeZoneInfo.Utc)
Assert.Empty(result);
else
if (TimeZoneInfo.Local.Equals(TimeZoneInfo.Utc))
Assert.Single(result);
else
Assert.Empty(result);
}

[Fact]
Expand Down Expand Up @@ -91,10 +91,10 @@ public void DateTimeOffsetNotEqualIncorrectUtcOffset()
output.WriteLine(filter);

var result = SimpleClass.CreateQuery().OData().Filter(filter).ToArray();
if (TimeZoneInfo.Local != TimeZoneInfo.Utc)
Assert.Empty(result);
else
if (TimeZoneInfo.Local.Equals(TimeZoneInfo.Utc))
Assert.Single(result);
else
Assert.Empty(result);
}

[Fact]
Expand Down Expand Up @@ -131,10 +131,10 @@ public void UtcDateTimeNotEqualIncorrectLocalOffset()
output.WriteLine(filter);

var result = SimpleClass.CreateQuery().OData(c => c.QuerySettings.TimeZone = TimeZoneInfo.Utc).Filter(filter).ToArray();
if (TimeZoneInfo.Local != TimeZoneInfo.Utc)
Assert.Empty(result);
else
if (TimeZoneInfo.Local.Equals(TimeZoneInfo.Utc))
Assert.Single(result);
else
Assert.Empty(result);
}

[Fact]
Expand All @@ -145,10 +145,10 @@ public void UtcDateTimeNotEqualIncorrectLocalOffset2()
output.WriteLine(filter);

var result = SimpleClass.CreateQuery().OData(c => c.QuerySettings.TimeZone = TimeZoneInfo.Utc).Filter(filter).ToArray();
if (TimeZoneInfo.Local != TimeZoneInfo.Utc)
Assert.Empty(result);
else
if (TimeZoneInfo.Local.Equals(TimeZoneInfo.Utc))
Assert.Single(result);
else
Assert.Empty(result);
}

[Fact]
Expand All @@ -160,10 +160,10 @@ public void UtcDateTimetNotEqualIncorrectUtcOffset()

var result = SimpleClass.CreateQuery().OData(c => c.QuerySettings.TimeZone = TimeZoneInfo.Utc).Filter(filter).ToArray();

if (TimeZoneInfo.Local != TimeZoneInfo.Utc)
Assert.Empty(result);
else
if (TimeZoneInfo.Local.Equals(TimeZoneInfo.Utc))
Assert.Single(result);
else
Assert.Empty(result);
}

[Fact]
Expand All @@ -175,9 +175,11 @@ public void DateTimeCompare()
Assert.Equal(dt, dtUtc);
Assert.Equal(dtUtc, dtLocal);

Assert.NotEqual(TimeZoneInfo.Local, TimeZoneInfo.Utc);
Assert.NotEqual(TimeZoneInfo.Local.GetHashCode(), TimeZoneInfo.Utc.GetHashCode());

if (!TimeZoneInfo.Local.Equals(TimeZoneInfo.Utc))
{
Assert.NotEqual(TimeZoneInfo.Local, TimeZoneInfo.Utc);
Assert.NotEqual(TimeZoneInfo.Local.GetHashCode(), TimeZoneInfo.Utc.GetHashCode());
}
Assert.Equal(TimeZoneInfo.Utc, TimeZoneInfo.Utc);
Assert.Equal(TimeZoneInfo.Utc.GetHashCode(), TimeZoneInfo.Utc.GetHashCode());
}
Expand Down

0 comments on commit f887b25

Please sign in to comment.