Skip to content

Commit

Permalink
- Fix Datatime Github Issue.
Browse files Browse the repository at this point in the history
  • Loading branch information
NinjaRocks committed Nov 22, 2024
1 parent 9e8b217 commit 530aed6
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 6 deletions.
Binary file modified tests/Schemio.EntityFramework.Tests/Customer.db
Binary file not shown.
3 changes: 2 additions & 1 deletion tests/Schemio.EntityFramework.Tests/CustomerDbContext.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System.Globalization;
using Microsoft.EntityFrameworkCore;
using Schemio.Core.Helpers;
using Schemio.EntityFramework.Tests.Domain;
Expand Down Expand Up @@ -54,7 +55,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
eb.HasKey(b => b.OrderId);
eb.Property(b => b.OrderNo);
eb.Property(b => b.Date).HasColumnName("OrderDate")
.HasConversion(v => v.ToShortDateString(), s => s.IsNotNullOrEmpty() ? DateTime.ParseExact(s, "dd/MM/yyyy", null) : DateTime.MinValue);
.HasConversion(v => v.ToShortDateString(), s => s.IsNotNullOrEmpty() ? DateTime.ParseExact(s, "dd/MM/yyyy HH:mm:ss", CultureInfo.InvariantCulture) : DateTime.MinValue);
eb.HasOne(b => b.Customer);
eb.HasMany(b => b.Items);
});
Expand Down
4 changes: 2 additions & 2 deletions tests/Schemio.EntityFramework.Tests/E2E.Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public void TestDataProviderToFetchWholeEntityWhenPathsAreNull()
Orders = [ new Order {
OrderId = 1,
OrderNo = "ZX123VH",
Date = DateTime.Parse("2021-10-22T00:00:00"),
Date = DateTime.Parse("2021-10-22T12:13:04"),
Items =
[
new OrderItem
Expand Down Expand Up @@ -117,7 +117,7 @@ public void TestDataProviderToFetchEntityWhenPathsContainsOrderItems()
{
OrderId = 1,
OrderNo = "ZX123VH",
Date = DateTime.Parse("2021-10-22T00:00:00"),
Date = DateTime.Parse("2021-10-22T12:13:04"),
Items =
[
new OrderItem
Expand Down
Binary file modified tests/Schemio.SQL.Tests/Customer.db
Binary file not shown.
4 changes: 2 additions & 2 deletions tests/Schemio.SQL.Tests/E2E.Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public void TestDataProviderToFetchWholeEntityWhenPathsAreNull()
Orders = [ new Order {
OrderId = 1,
OrderNo = "ZX123VH",
Date = DateTime.Parse("2021-10-22T00:00:00"),
Date = DateTime.Parse("2021-10-22T12:13:04"),
Items =
[
new OrderItem
Expand Down Expand Up @@ -84,7 +84,7 @@ public void TestDataProviderToFetchEntityWhenPathsContainsOrderItems()
{
OrderId = 1,
OrderNo = "ZX123VH",
Date = DateTime.Parse("2021-10-22T00:00:00"),
Date = DateTime.Parse("2021-10-22T12:13:04"),
Items =
[
new OrderItem
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System.Globalization;
using Schemio.Core;
using Schemio.SQL.Tests.EntitySetup.Entities;
using Schemio.SQL.Tests.EntitySetup.EntitySchemas.Queries;
Expand All @@ -19,7 +20,7 @@ public override void Transform(CollectionResult<OrderRecord> collectionResult, C
{
customer.Orders[index] = new Order
{
Date = DateTime.Parse(collectionResult[index].OrderDate),
Date = DateTime.ParseExact(collectionResult[index].OrderDate, "dd/MM/yyyy HH:mm:ss", CultureInfo.InvariantCulture),
OrderId = collectionResult[index].OrderId,
OrderNo = collectionResult[index].OrderNo
};
Expand Down

0 comments on commit 530aed6

Please sign in to comment.