Skip to content
This repository was archived by the owner on Feb 1, 2025. It is now read-only.

Commit dddd88c

Browse files
authored
Added UInt tests. (#158)
1 parent 553c4f6 commit dddd88c

File tree

4 files changed

+40
-2
lines changed

4 files changed

+40
-2
lines changed

Tests/LinqToDB.EntityFrameworkCore.BaseTests/ForMappingTestsBase.cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System;
22
using System.Collections.Generic;
33
using System.Linq;
4+
using System.Threading.Tasks;
45
using FluentAssertions;
56
using LinqToDB.Data;
67
using LinqToDB.EntityFrameworkCore.BaseTests.Models.ForMapping;
@@ -87,5 +88,25 @@ public virtual void TestBulkCopyWithIdentity()
8788
t.Should().HaveCount(items.Count);
8889
}
8990

91+
[Test]
92+
public virtual async Task TestUIntTable()
93+
{
94+
using var context = CreateContext();
95+
context.UIntTable.Add(new UIntTable
96+
{
97+
Field16 = 1,
98+
Field16N = 2,
99+
Field32 = 3,
100+
Field32N = 4,
101+
Field64 = 5,
102+
Field64N = 6
103+
});
104+
105+
await context.SaveChangesAsync();
106+
107+
ulong field64 = 5;
108+
var item = await context.UIntTable.FirstOrDefaultAsyncLinqToDB(e => e.Field64 == field64);
109+
}
110+
90111
}
91112
}

Tests/LinqToDB.EntityFrameworkCore.BaseTests/Models/ForMapping/ForMappingContextBase.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ protected ForMappingContextBase(DbContextOptions options) : base(options)
1010

1111
public DbSet<WithIdentity> WithIdentity { get; set; } = null!;
1212
public DbSet<NoIdentity> NoIdentity { get; set; } = null!;
13-
13+
public DbSet<UIntTable> UIntTable { get; set; } = null!;
1414
}
1515
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
using System.ComponentModel.DataAnnotations;
2+
3+
namespace LinqToDB.EntityFrameworkCore.BaseTests.Models.ForMapping
4+
{
5+
public class UIntTable
6+
{
7+
[Key]
8+
public int ID { get; set; }
9+
10+
public ushort Field16 { get; set; }
11+
public uint Field32 { get; set; }
12+
public ulong Field64 { get; set; }
13+
public ushort? Field16N { get; set; }
14+
public uint? Field32N { get; set; }
15+
public ulong? Field64N { get; set; }
16+
}
17+
}

Tests/LinqToDB.EntityFrameworkCore.PostgreSQL.Tests/ForMappingTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public override ForMappingContextBase CreateContext()
2323
var options = optionsBuilder.Options;
2424
var ctx = new ForMappingContext(options);
2525

26-
//ctx.Database.EnsureDeleted();
26+
ctx.Database.EnsureDeleted();
2727
ctx.Database.EnsureCreated();
2828

2929
return ctx;

0 commit comments

Comments
 (0)