Skip to content

Commit 530aed6

Browse files
committed
- Fix Datatime Github Issue.
1 parent 9e8b217 commit 530aed6

File tree

6 files changed

+8
-6
lines changed

6 files changed

+8
-6
lines changed
0 Bytes
Binary file not shown.

tests/Schemio.EntityFramework.Tests/CustomerDbContext.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using System.Globalization;
12
using Microsoft.EntityFrameworkCore;
23
using Schemio.Core.Helpers;
34
using Schemio.EntityFramework.Tests.Domain;
@@ -54,7 +55,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
5455
eb.HasKey(b => b.OrderId);
5556
eb.Property(b => b.OrderNo);
5657
eb.Property(b => b.Date).HasColumnName("OrderDate")
57-
.HasConversion(v => v.ToShortDateString(), s => s.IsNotNullOrEmpty() ? DateTime.ParseExact(s, "dd/MM/yyyy", null) : DateTime.MinValue);
58+
.HasConversion(v => v.ToShortDateString(), s => s.IsNotNullOrEmpty() ? DateTime.ParseExact(s, "dd/MM/yyyy HH:mm:ss", CultureInfo.InvariantCulture) : DateTime.MinValue);
5859
eb.HasOne(b => b.Customer);
5960
eb.HasMany(b => b.Items);
6061
});

tests/Schemio.EntityFramework.Tests/E2E.Tests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public void TestDataProviderToFetchWholeEntityWhenPathsAreNull()
4747
Orders = [ new Order {
4848
OrderId = 1,
4949
OrderNo = "ZX123VH",
50-
Date = DateTime.Parse("2021-10-22T00:00:00"),
50+
Date = DateTime.Parse("2021-10-22T12:13:04"),
5151
Items =
5252
[
5353
new OrderItem
@@ -117,7 +117,7 @@ public void TestDataProviderToFetchEntityWhenPathsContainsOrderItems()
117117
{
118118
OrderId = 1,
119119
OrderNo = "ZX123VH",
120-
Date = DateTime.Parse("2021-10-22T00:00:00"),
120+
Date = DateTime.Parse("2021-10-22T12:13:04"),
121121
Items =
122122
[
123123
new OrderItem
0 Bytes
Binary file not shown.

tests/Schemio.SQL.Tests/E2E.Tests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public void TestDataProviderToFetchWholeEntityWhenPathsAreNull()
4848
Orders = [ new Order {
4949
OrderId = 1,
5050
OrderNo = "ZX123VH",
51-
Date = DateTime.Parse("2021-10-22T00:00:00"),
51+
Date = DateTime.Parse("2021-10-22T12:13:04"),
5252
Items =
5353
[
5454
new OrderItem
@@ -84,7 +84,7 @@ public void TestDataProviderToFetchEntityWhenPathsContainsOrderItems()
8484
{
8585
OrderId = 1,
8686
OrderNo = "ZX123VH",
87-
Date = DateTime.Parse("2021-10-22T00:00:00"),
87+
Date = DateTime.Parse("2021-10-22T12:13:04"),
8888
Items =
8989
[
9090
new OrderItem

tests/Schemio.SQL.Tests/EntitySetup/EntityConfiguration/Transforms/OrdersTransform.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using System.Globalization;
12
using Schemio.Core;
23
using Schemio.SQL.Tests.EntitySetup.Entities;
34
using Schemio.SQL.Tests.EntitySetup.EntitySchemas.Queries;
@@ -19,7 +20,7 @@ public override void Transform(CollectionResult<OrderRecord> collectionResult, C
1920
{
2021
customer.Orders[index] = new Order
2122
{
22-
Date = DateTime.Parse(collectionResult[index].OrderDate),
23+
Date = DateTime.ParseExact(collectionResult[index].OrderDate, "dd/MM/yyyy HH:mm:ss", CultureInfo.InvariantCulture),
2324
OrderId = collectionResult[index].OrderId,
2425
OrderNo = collectionResult[index].OrderNo
2526
};

0 commit comments

Comments
 (0)