Skip to content

Commit

Permalink
test: add DateTime Kind tests
Browse files Browse the repository at this point in the history
  • Loading branch information
alirezanet committed Aug 7, 2024
1 parent 30dbe17 commit 26e9ebc
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions test/EntityFrameworkPostgreSqlIntegrationTests/Issue188Tests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using EntityFrameworkIntegrationTests.cs;
using Microsoft.EntityFrameworkCore;
using Xunit;

namespace Gridify.Tests;

public class Issue188Tests
{

private readonly MyDbContext _dbContext = new();

[Fact]
public void DateTimeFilteringWithUTCKind_UsingGridifyMapper_ShouldNotThrowException()
{
var mapper = new GridifyMapper<User>(q => q.DefaultDateTimeKind = DateTimeKind.Utc)
.GenerateMappings();
_dbContext.Users.ApplyFiltering("CreateDate>2023-11-14", mapper).ToQueryString();
}

[Fact]
public void DateTimeFilteringWithUTCKind_UsingGlobalConfiguration_ShouldNotThrowException()
{
GridifyGlobalConfiguration.DefaultDateTimeKind = DateTimeKind.Utc;
_dbContext.Users.ApplyFiltering("CreateDate>2023-11-14").ToQueryString();
GridifyGlobalConfiguration.DefaultDateTimeKind = null;
}

}


0 comments on commit 26e9ebc

Please sign in to comment.