Skip to content

Commit f4802d5

Browse files
committed
Version 8.0.0-rc1-0001
1 parent 20cf3d1 commit f4802d5

File tree

7 files changed

+9
-84
lines changed

7 files changed

+9
-84
lines changed

BenchmarkPostgreSql/Program.cs

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
using BenchmarkDotNet.Running;
33
using DataLayer.BookApp.EfCode;
44
using Npgsql;
5-
using Test.Helpers;
65
using TestSupport.EfHelpers;
76

87
public class Program
@@ -32,18 +31,6 @@ public void EnsureCleanUsingDropSchema()
3231
_context.Database.EnsureClean();
3332
}
3433

35-
[Benchmark]
36-
public async Task WipedByRespawnNoCheckDbExists()
37-
{
38-
await _context.EnsureCreatedAndEmptyPostgreSqlAsync(true);
39-
}
40-
41-
//[Benchmark]
42-
//public async Task WipedByRespawnWithCheckForDbExists()
43-
//{
44-
// await _context.EnsureCreatedAndEmptyPostgreSqlAsync();
45-
//}
46-
4734
[Benchmark]
4835
public void EnsureDeletedEnsureCreated()
4936
{

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@ This NuGet package containing methods to help test applications that use [Entity
55
The EfCore.TestSupport library is available on [NuGet as EfCore.TestSupport](https://www.nuget.org/packages/EfCore.TestSupport/) and is an open-source library under the MIT license. See [ReleaseNotes](https://github.com/JonPSmith/EfCore.TestSupport/blob/master/ReleaseNotes.md) for details of the changes in each vesion.
66

77

8-
## List of versions and which .NET framwork they support
8+
## List of versions and which .NET framework they support
99

10-
- Version 6.0.?: Supports NET 7 and 8
10+
The versions of this library has changed to make it easier to create a new version when a new release of .NET farmework. Now the first number defines the .NET version, e.g EfCore.TestSupport version 8.?.? only runs on .NET 8.
11+
12+
- Version 8.?.?: Supports NET 8
1113
- Version 5.2.0: Supports NET 5, 6 and 7
1214
- Version 5.1.0: Supports NET 5, 6
1315

ReleaseNotes.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Release notes
22

3+
## 8.0.0-rc1-0001
4+
5+
- First build using NET 8-rc1
6+
37
## 6.0.0
48

59
- Updated to support NET 7 and NET 8

Test/UnitCommands/DeleteAllUnitTestDatabases.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// Copyright (c) 2020 Jon P Smith, GitHub: JonPSmith, web: http://www.thereformedprogrammer.net/
22
// Licensed under MIT license. See License.txt in the project root for license information.
33

4-
using Test.Helpers;
54
using TestSupport.Attributes;
65
using TestSupport.EfHelpers;
76
using Xunit.Abstractions;

Test/UnitTests/TestDataLayer/TestEnsureCleanPostgreSql.cs

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -232,39 +232,6 @@ public void TestEnsureCleanApplyMigrationOk()
232232
context.Books.Count().ShouldEqual(0);
233233
}
234234

235-
[Fact]
236-
public async Task TestRespawnWithCheckDbExists()
237-
{
238-
//SETUP
239-
var options = this.CreatePostgreSqlUniqueMethodOptions<BookContext>();
240-
using var context = new BookContext(options);
241-
context.Database.EnsureCreated();
242-
243-
//ATTEMPT
244-
using (new TimeThings(_output))
245-
await context.EnsureCreatedAndEmptyPostgreSqlAsync();
246-
247-
//VERIFY
248-
context.Books.Count().ShouldEqual(0);
249-
}
250-
251-
[Fact]
252-
public async Task TestRespawnNoCheckDbExists()
253-
{
254-
//SETUP
255-
var options = this.CreatePostgreSqlUniqueMethodOptions<BookContext>();
256-
using var context = new BookContext(options);
257-
context.Database.EnsureCreated();
258-
259-
//ATTEMPT
260-
using (new TimeThings(_output))
261-
await context.EnsureCreatedAndEmptyPostgreSqlAsync(true);
262-
263-
//VERIFY
264-
context.Books.Count().ShouldEqual(0);
265-
}
266-
267-
268235
private int CountTablesInDatabase(DbContext context)
269236
{
270237
return context.Database.ExecuteSqlRaw(

TestSupport/EfHelpers/PostgreSqlHelpers.cs

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
using System.Runtime.CompilerServices;
66
using System.Threading.Tasks;
77
using Microsoft.EntityFrameworkCore;
8-
using Npgsql;
9-
using Respawn;
108
using TestSupport.EfHelpers.Internal;
119
using TestSupport.Helpers;
1210

@@ -74,37 +72,6 @@ public static DbContextOptions<T> CreatePostgreSqlUniqueMethodOptions<T>(this ob
7472
return CreatePostgreSqlOptionWithDatabaseName<T>(callingClass, callingMember, builder).Options;
7573
}
7674

77-
//------------------------------------------------
78-
79-
/// <summary>
80-
/// This will ensure that there is a PostgreSql database, and that database has no rows in any tables
81-
/// NOTE: If you change anything that alters the database schema, then you must delete the database
82-
/// and have EF Core recreate the database
83-
/// </summary>
84-
/// <typeparam name="T"></typeparam>
85-
/// <param name="context"></param>
86-
/// <param name="thereIsAnExistingDatabase">Optional: If you know that there is a database, then set this to true for a quicker clear of all the tables</param>
87-
/// <returns></returns>
88-
public async static Task EnsureCreatedAndEmptyPostgreSqlAsync<T>(this T context, bool thereIsAnExistingDatabase = false)
89-
where T : DbContext
90-
{
91-
//see https://github.com/dotnet/efcore/issues/26541 for the solution
92-
Checkpoint EmptyCheckpoint = new Checkpoint
93-
{
94-
DbAdapter = DbAdapter.Postgres
95-
};
96-
97-
if (thereIsAnExistingDatabase || !context.Database.EnsureCreated())
98-
{
99-
//the database already exists, so we just need to empty the tables
100-
101-
var connectionString = context.Database.GetConnectionString();
102-
using var conn = new NpgsqlConnection(connectionString);
103-
await conn.OpenAsync();
104-
await EmptyCheckpoint.Reset(conn);
105-
};
106-
}
107-
10875
//------------------------------------------------
10976
//private methods
11077

TestSupport/TestSupport.csproj

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,13 @@
1818
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="8.0.0-rc.1.23419.4" />
1919
<PackageReference Include="Microsoft.Data.SqlClient" Version="5.1.1" />
2020
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.0-rc.1" />
21-
<PackageReference Include="Respawn" Version="6.1.0 " />
2221
<PackageReference Include="xunit.assert" Version="2.5.0" />
2322
<PackageReference Include="xunit.core" Version="2.5.0" />
2423
</ItemGroup>
2524

2625
<PropertyGroup>
2726
<PackageId>EfCore.TestSupport</PackageId>
28-
<PackageVersion>8.0.0</PackageVersion>
27+
<PackageVersion>8.0.0-rc1-0001</PackageVersion>
2928
<Version>8.0.0</Version>
3029
<AssemblyVersion>8.0.0.0</AssemblyVersion>
3130
<FileVersion>8.0.0.0</FileVersion>

0 commit comments

Comments
 (0)