Skip to content

Commit

Permalink
Added DecimalTests
Browse files Browse the repository at this point in the history
  • Loading branch information
WanjohiSammy committed Jan 3, 2025
1 parent ee15ca2 commit 53545d9
Showing 1 changed file with 31 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public override void ConfigureServices(IServiceCollection services)
}

public PrimitiveKeysValuesTests(TestWebApplicationFactory<PrimitiveKeysValuesTests.TestsStartup> fixture)
: base(fixture)
: base(fixture)
{
if (Client.BaseAddress == null)
{
Expand Down Expand Up @@ -108,6 +108,26 @@ public void DateTimeOffsetTest()
}
}

[Fact]
public void DecimalTest()
{
foreach (var entry in _context.EdmDecimalSet)
{
if(entry.Id == Decimal.MaxValue || entry.Id == Decimal.MinValue)
{
continue;
}

// Arrange & Act
var query = _context.CreateQuery<EdmDecimal>("EdmDecimalSet").Where(e => e.Id == entry.Id);
var queryResult = query.ToArray();

// Assert
//Expected a single result for key value {0}, entry.Id.ToString(CultureInfo.InvariantCulture)
Assert.Single(queryResult);
}
}

[Fact]
public void DoubleTest()
{
Expand Down Expand Up @@ -225,14 +245,18 @@ public void TimeTest()

#region Private

private static bool IsNotSupportedKey(float key)
private static bool IsNotSupportedKey(object key)
{
return float.IsNaN(key);
}
if (key is float keyInFloat)
{
return float.IsNaN(keyInFloat);
}
if (key is double keyInDouble)
{
return double.IsNaN(keyInDouble);
}

private static bool IsNotSupportedKey(double key)
{
return double.IsNaN(key);
return false;
}

private void ResetDefaultDataSource()
Expand Down

0 comments on commit 53545d9

Please sign in to comment.