Skip to content

Commit 88dc018

Browse files
Updates the README.
1 parent c075a61 commit 88dc018

6 files changed

Lines changed: 48 additions & 15 deletions

File tree

README.md

Lines changed: 48 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
# PosInformatique.Testing.Databases
22

3-
[![NuGet Version](https://img.shields.io/nuget/v/PosInformatique.Testing.Databases.SqlServer?label=PosInformatique.Testing.Databases.SqlServer)](https://www.nuget.org/packages/PosInformatique.Testing.Databases.SqlServer)
4-
[![NuGet Version](https://img.shields.io/nuget/v/PosInformatique.Testing.Databases.SqlServer.Dac?label=PosInformatique.Testing.Databases.SqlServer.Dac)](https://www.nuget.org/packages/PosInformatique.Testing.Databases.SqlServer.Dac)
5-
[![NuGet Version](https://img.shields.io/nuget/v/PosInformatique.Testing.Databases.SqlServer.EntityFramework?label=PosInformatique.Testing.Databases.SqlServer.EntityFramework)](https://www.nuget.org/packages/PosInformatique.Testing.Databases.SqlServer.EntityFramework)
3+
| Package | NuGet |
4+
|---------|-------|
5+
| PosInformatique.Testing.Databases.SqlServer | [![NuGet](https://img.shields.io/nuget/v/PosInformatique.Testing.Databases.SqlServer)](https://www.nuget.org/packages/PosInformatique.Testing.Databases.SqlServer) |
6+
| PosInformatique.Testing.Databases.SqlServer.Dac | [![NuGet](https://img.shields.io/nuget/v/PosInformatique.Testing.Databases.SqlServer.Dac)](https://www.nuget.org/packages/PosInformatique.Testing.Databases.SqlServer.Dac) |
7+
| PosInformatique.Testing.Databases.SqlServer.EntityFramework | [![NuGet](https://img.shields.io/nuget/v/PosInformatique.Testing.Databases.SqlServer.EntityFramework)](https://www.nuget.org/packages/PosInformatique.Testing.Databases.SqlServer.EntityFramework) |
8+
| PosInformatique.Testing.Databases.SqlServer.SqlCmd | [![NuGet](https://img.shields.io/nuget/v/PosInformatique.Testing.Databases.SqlServer.SqlCmd)](https://www.nuget.org/packages/PosInformatique.Testing.Databases.SqlServer.SqlCmd) |
69

710
**PosInformatique.Testing.Databases** is a set of tools for testing databases.
811
It simplifies writing and executing tests, helping ensure your database and data access code are reliable and bug-free.
@@ -19,7 +22,10 @@ You can also use this tools to create and run integration tests with the
1922
[Integration tests in ASP.NET Core](https://learn.microsoft.com/en-us/aspnet/core/test/integration-tests?view=aspnetcore-8.0)
2023
approach.
2124

22-
Since the version 2.0.0 this tools provide a comparer to compare the schema of two SQL databases.
25+
### Main release improvements
26+
- v2.0: This tools provide a comparer to compare the schema of two SQL databases.
27+
- v3.0: Add new [PosInformatique.Testing.Databases.SqlServer.SqlCmd](https://www.nuget.org/packages/PosInformatique.Testing.Databases.SqlServer.SqlCmd) which allows
28+
to deploy database using a T-SQL script with the SQL Server [sqlcmd utility](https://learn.microsoft.com/en-us/sql/tools/sqlcmd/sqlcmd-utility).
2329

2430
## 💡 The approach of these tools
2531

@@ -46,9 +52,10 @@ Before each test (`TestMethod` or `Fact` methods):
4652

4753
1. Create an empty database with the SQL schema of the application.
4854

49-
There are two ways to do this:
50-
- Deploy a DACPAC file (built by a SQL Server Database project).
51-
- Or create a database from a `DbContext` using Entity Framework.
55+
There are three ways to do this:
56+
- Deploy a DACPAC file (built by a SQL Server Database project) using [PosInformatique.Testing.Databases.SqlServer.Dac](https://www.nuget.org/packages/PosInformatique.Testing.Databases.SqlServer.Dac) library.
57+
- Create a database from a `DbContext` using Entity Framework using [PosInformatique.Testing.Databases.SqlServer.EntityFramework](https://www.nuget.org/packages/PosInformatique.Testing.Databases.SqlServer.EntityFramework) library.
58+
- Or create a database since a T-SQL script file using [PosInformatique.Testing.Databases.SqlServer.SqlCmd](https://www.nuget.org/packages/PosInformatique.Testing.Databases.SqlServer.SqlCmd) library
5259

5360
2. Fill the tables with the sample data needed.
5461

@@ -69,19 +76,21 @@ To perform tests of a database migration, the approach is straightforward and re
6976

7077
2. Create a secondary database with the targeted schema (*target database*).
7178

72-
There are two ways to do this:
73-
- Deploy a DACPAC file (built by a SQL Server Database project).
74-
- Or create a database from a `DbContext` using Entity Framework.
79+
There are three ways to do this:
80+
- Deploy a DACPAC file (built by a SQL Server Database project) using [PosInformatique.Testing.Databases.SqlServer.Dac](https://www.nuget.org/packages/PosInformatique.Testing.Databases.SqlServer.Dac) library.
81+
- Create a database from a `DbContext` using Entity Framework using [PosInformatique.Testing.Databases.SqlServer.EntityFramework](https://www.nuget.org/packages/PosInformatique.Testing.Databases.SqlServer.EntityFramework) library.
82+
- Or create a database since a T-SQL script file using [PosInformatique.Testing.Databases.SqlServer.SqlCmd](https://www.nuget.org/packages/PosInformatique.Testing.Databases.SqlServer.SqlCmd) library
7583

7684
3. Execute your database *migration code* on the *initial database*.
7785

7886
Your database *migration code* can be:
7987
- A simple SQL script file.
8088
- An Entity Framework migration sets executed with the `MigrateAsync()` method.
89+
- Or any other way that you usually use to migrate the schema of your database.
8190

8291
4. Compare the two databases schemas (*initial* and *target*).
8392

84-
If the database *migration code* works, the *initial* and *target* must have the same schema.
93+
If the database *migration code* works, the *initial* and *target* must have **EXACTLY** the same schema.
8594

8695
> **NB**: The initial database is not necessarily empty. It can be at a specific schema version X if we want to test the migration from version X to Y.
8796
@@ -119,6 +128,10 @@ The [PosInformatique.Testing.Databases](https://github.com/PosInformatique/PosIn
119128
- [PosInformatique.Testing.Databases.SqlServer.EntityFramework](https://www.nuget.org/packages/PosInformatique.Testing.Databases.SqlServer.EntityFramework) NuGet package which contains:
120129
- Tools to deploy a SQL Server database using a DbContext.
121130

131+
- [PosInformatique.Testing.Databases.SqlServer.SqlCmd](https://www.nuget.org/packages/PosInformatique.Testing.Databases.SqlServer.SqlCmd) NuGet package which contains:
132+
- Tools to execute T-SQL script using the SQL Server [sqlcmd utility](https://learn.microsoft.com/en-us/sql/tools/sqlcmd/sqlcmd-utility). This script can be use to deploy a
133+
SQL Server database.
134+
122135
## 🚀 Samples / Demo
123136

124137
A complete sample solution is available in this repository inside the [samples](./samples) folder.
@@ -160,3 +173,27 @@ For Entity Framework migration:
160173
- [Add the NuGet packages](./docs/WriteDatabaseMigrationTest.md#add-the-nuget-packages)
161174
- [Write test to check the migration of the database](./docs/WriteDatabaseMigrationTest.md#write-test-to-check-the-migration-of-the-database)
162175
- [Check the report details of the `SqlServerDatabaseComparer` tool](./docs/WriteDatabaseMigrationTest.md#check-the-report-details-of-the-sqlserverdatabasecomparer-tool)
176+
177+
## 📦 NuGet package dependency versions
178+
179+
These tools rely on a minimal set of NuGet dependencies to ensure broad compatibility.
180+
They are built for **.NET 6.0** but also work seamlessly with newer versions of .NET:
181+
182+
- .NET 7.0
183+
- .NET 8.0
184+
- .NET 9.0
185+
- .NET 10.0
186+
187+
### Dependency versions
188+
189+
All NuGet packages depend on **low baseline versions** of Microsoft libraries to remain compatible with any modern version:
190+
191+
- [Microsoft.Data.SqlClient](https://www.nuget.org/packages/microsoft.data.sqlclient) >= 5.0.1
192+
- [Microsoft.EntityFrameworkCore](https://www.nuget.org/packages/microsoft.entityframeworkcore) >= 6.0.0
193+
- [Microsoft.EntityFrameworkCore.SqlServer](https://www.nuget.org/packages/microsoft.entityframeworkcore.sqlserver) >= 6.0.0
194+
- [Microsoft.EntityFrameworkCore.Tools](https://www.nuget.org/packages/microsoft.entityframeworkcore.tools) >= 6.0.0
195+
- [Microsoft.SqlServer.DacFx](https://www.nuget.org/packages/microsoft.sqlserver.dacfx) >= 162.1.172
196+
197+
### Recommendation
198+
199+
We recommend using the **latest versions** of these libraries in your own projects to benefit from the most recent features, performance improvements, and security fixes.
-21.7 KB
Loading
7.54 KB
Loading
21.6 KB
Loading
-21.7 KB
Loading

src/Testing.Databases.SqlServer/Testing.Databases.SqlServer.csproj

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,6 @@
1212
<None Include="..\..\README.md" Pack="true" PackagePath="\" />
1313
</ItemGroup>
1414

15-
<ItemGroup>
16-
<None Include="Icon.png" Pack="true" PackagePath="" />
17-
</ItemGroup>
18-
1915
<ItemGroup>
2016
<PackageReference Include="Microsoft.Data.SqlClient" />
2117
</ItemGroup>

0 commit comments

Comments
 (0)