Skip to content

Commit 6193e61

Browse files
fix tests
1 parent 1e28707 commit 6193e61

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/EFCore.Ydb/test/EntityFrameworkCore.Ydb.FunctionalTests/Query/DecimalParameterizedYdbTest.cs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using EntityFrameworkCore.Ydb.Extensions;
2+
using EntityFrameworkCore.Ydb.FunctionalTests.TestUtilities;
23
using Microsoft.EntityFrameworkCore;
34
using Microsoft.EntityFrameworkCore.Infrastructure;
45
using Microsoft.EntityFrameworkCore.Storage;
@@ -46,7 +47,10 @@ private static DbContextOptions<ParametricDecimalContext> BuildOptions() =>
4647
[MemberData(nameof(SuccessCases))]
4748
public async Task Should_RoundtripDecimal_When_ValueFitsPrecisionAndScale(int p, int s, decimal value)
4849
{
50+
await using var testStore = YdbTestStoreFactory.Instance.Create("DecimalParameterizedYdb");
51+
4952
await using var ctx = NewCtx(p, s);
53+
await testStore.CleanAsync(ctx);
5054
await ctx.Database.EnsureCreatedAsync();
5155
try
5256
{
@@ -71,7 +75,10 @@ public async Task Should_RoundtripDecimal_When_ValueFitsPrecisionAndScale(int p,
7175
[MemberData(nameof(OverflowCases))]
7276
public async Task Should_ThrowOverflow_When_ValueExceedsPrecisionOrScale(int p, int s, decimal value)
7377
{
78+
await using var testStore = YdbTestStoreFactory.Instance.Create("DecimalParameterizedYdb");
79+
7480
await using var ctx = NewCtx(p, s);
81+
await testStore.CleanAsync(ctx);
7582
await ctx.Database.EnsureCreatedAsync();
7683
try
7784
{
@@ -88,8 +95,11 @@ public async Task Should_ThrowOverflow_When_ValueExceedsPrecisionOrScale(int p,
8895
[MemberData(nameof(SuccessCases))]
8996
public async Task Should_SumDecimal_When_ValueFitsPrecisionAndScale(int p, int s, decimal value)
9097
{
98+
await using var testStore = YdbTestStoreFactory.Instance.Create("DecimalParameterizedYdb");
99+
91100
const int multiplier = 5;
92101
await using var ctx = NewCtx(p, s);
102+
await testStore.CleanAsync(ctx);
93103
await ctx.Database.EnsureCreatedAsync();
94104
try
95105
{
@@ -119,7 +129,7 @@ public sealed class ParametricDecimalContext(DbContextOptions<ParametricDecimalC
119129

120130
protected override void OnModelCreating(ModelBuilder modelBuilder) => modelBuilder.Entity<ParamItem>(b =>
121131
{
122-
b.ToTable($"Items_{p}_{s}_{Guid.NewGuid():N}");
132+
b.ToTable($"Items_{p}_{s}");
123133
b.HasKey(x => x.Id);
124134
b.Property(x => x.Price).HasPrecision(p, s);
125135
});
@@ -130,4 +140,6 @@ public sealed class ParamItem
130140
public int Id { get; init; }
131141
public decimal Price { get; init; }
132142
}
143+
144+
public Task DisposeAsync() => throw new NotImplementedException();
133145
}

0 commit comments

Comments
 (0)