From 5f1d5cd1f1b3f87753c4b086ac5adc4a232f6a5b Mon Sep 17 00:00:00 2001 From: Gilles TOURREAU Date: Tue, 3 Sep 2024 08:29:30 +0200 Subject: [PATCH 1/6] Fix documentation --- docs/WriteUnitTests.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/WriteUnitTests.md b/docs/WriteUnitTests.md index fd88634..eeeca9a 100644 --- a/docs/WriteUnitTests.md +++ b/docs/WriteUnitTests.md @@ -57,7 +57,7 @@ public class CustomerRepository Which use the following `DbContext` implementation: -```json +```csharp public class DemoAppDbContext : DbContext { public DemoAppDbContext(DbContextOptions options) From a8669d8953986e3928306e206c466223b386321c Mon Sep 17 00:00:00 2001 From: Gilles TOURREAU Date: Mon, 23 Sep 2024 04:53:17 +0200 Subject: [PATCH 2/6] Fix the links in the README file --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d56cd1d..26b1ffa 100644 --- a/README.md +++ b/README.md @@ -63,12 +63,12 @@ Using the previous approach, the [PosInformatique.UnitTests.Databases](https://g The [PosInformatique.UnitTests.Databases](https://github.com/PosInformatique/PosInformatique.UnitTests.Databases) tools are provided in two NuGet packages: -- [![Nuget](https://img.shields.io/nuget/v/PosInformatique.UnitTests.Databases.SqlServer)](https://www.nuget.org/packages/PosInformatique.UnitTests.Databases.SqlServer) which contains: +- [PosInformatique.UnitTests.Databases.SqlServer](https://www.nuget.org/packages/PosInformatique.UnitTests.Databases.SqlServer) NuGet package which contains: - Tools to deploy a SQL Server database using a DACPAC file before each unit test. - Helpers to initialize SQL Server databases with sample data. - Helpers to easily query SQL Server databases. -- [![Nuget](https://img.shields.io/nuget/v/PosInformatique.UnitTests.Databases.SqlServer.EntityFramework)](https://www.nuget.org/packages/PosInformatique.UnitTests.Databases.SqlServer.EntityFramework) which contains: +- [PosInformatique.UnitTests.Databases.SqlServer.EntityFramework](https://www.nuget.org/packages/PosInformatique.UnitTests.Databases.SqlServer.EntityFramework) NuGet package which contains: - Tools to deploy a SQL Server database using a DbContext. This package uses and includes the previous [PosInformatique.UnitTests.Databases.SqlServer](https://www.nuget.org/packages/PosInformatique.UnitTests.Databases.SqlServer) NuGet package. From faf2337cee4f031299bc14a7a8150491036db026 Mon Sep 17 00:00:00 2001 From: Gilles TOURREAU Date: Mon, 23 Sep 2024 04:56:01 +0200 Subject: [PATCH 3/6] Fix example in the documentation. --- docs/WriteUnitTests.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/WriteUnitTests.md b/docs/WriteUnitTests.md index eeeca9a..e52a4cf 100644 --- a/docs/WriteUnitTests.md +++ b/docs/WriteUnitTests.md @@ -282,6 +282,7 @@ this.database.InsertCustomer(id: 10, firstName: "John", lastName: "DOE"); In the end, if we want to insert 3 `Customer` rows in the database, the `CustomerRepositoryTest` constructor should look like this code: +```csharp public CustomerRepositoryTest(SqlServerDatabaseInitializer initializer) { using var dbContext = new DemoAppDbContext(UnitTestsConnectionStrings.CreateDbContextOptions(DatabaseName)); @@ -292,6 +293,7 @@ public CustomerRepositoryTest(SqlServerDatabaseInitializer initializer) this.database.InsertCustomer(id: 15, firstName: "Marcel", lastName: "DUPONT", revenue: 4852.45); this.database.InsertCustomer(id: 20, firstName: "Andres", lastName: "GARCIA"); } +``` Now, every time we will execute an unit test in the `CustomerRepositoryTest` class, a database will be deployed with these 3 `Customer` before the execution of the unit test. From 5ac2d695b5335610b6e0123d2767db0628836a0b Mon Sep 17 00:00:00 2001 From: Gilles TOURREAU Date: Mon, 23 Sep 2024 05:02:47 +0200 Subject: [PATCH 4/6] Fix the documentation. --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 26b1ffa..5f78f5b 100644 --- a/README.md +++ b/README.md @@ -75,13 +75,13 @@ The [PosInformatique.UnitTests.Databases](https://github.com/PosInformatique/Pos ## Samples / Demo -A complete sample solution is available in this repository in the [./samples](./samples) folder. +A complete sample solution is available in this repository inside the [samples](./samples) folder. -The solution contains the following projects: +The solution contains the following sample projects: - [DemoApp.Domain](./samples/DemoApp.Domain/DemoApp.Domain.csproj): Represents the domain of the application with a set of sample business entities. - [DemoApp.DataAccessLayer](./samples/DemoApp.DataAccessLayer/DemoApp.DataAccessLayer.csproj): Represents a Data Access Layer with a set of repositories to unit test. - [DemoApp.DataAccessLayer.Tests](./samples/DemoApp.DataAccessLayer.Tests/DemoApp.DataAccessLayer.Tests.csproj): Unit test project to test the [DemoApp.DataAccessLayer](./samples/DemoApp.DataAccessLayer/DemoApp.DataAccessLayer.csproj) -- project using the [PosInformatique.UnitTests.Databases.SqlServer](https://www.nuget.org/packages/PosInformatique.UnitTests.Databases.SqlServer) package. +project using the [PosInformatique.UnitTests.Databases.SqlServer.EntityFramework](https://www.nuget.org/packages/PosInformatique.UnitTests.Databases.SqlServer.EntityFramework) package. ## Writing unit tests for a Data Access Layer From 87ca09144acb6108cc87d089bbcb6f23c5f0642f Mon Sep 17 00:00:00 2001 From: Gilles TOURREAU Date: Mon, 23 Sep 2024 05:07:34 +0200 Subject: [PATCH 5/6] Fix the .editorconfig --- .editorconfig | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.editorconfig b/.editorconfig index ab2cf13..c60dfdf 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,4 +1,8 @@ -[*.cs] +[*] +indent_style = space +indent_size = 4 + +[*.cs] # StyleCop From 6051c066ff241f1317c3cc66b03ac03a3b092d66 Mon Sep 17 00:00:00 2001 From: Gilles TOURREAU Date: Mon, 23 Sep 2024 05:15:39 +0200 Subject: [PATCH 6/6] Fix release notes --- .../UnitTests.Databases.SqlServer.EntityFramework.csproj | 7 +++++-- .../UnitTests.Databases.SqlServer.csproj | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/UnitTests.Databases.SqlServer.EntityFramework/UnitTests.Databases.SqlServer.EntityFramework.csproj b/src/UnitTests.Databases.SqlServer.EntityFramework/UnitTests.Databases.SqlServer.EntityFramework.csproj index 89fc51f..7817e30 100644 --- a/src/UnitTests.Databases.SqlServer.EntityFramework/UnitTests.Databases.SqlServer.EntityFramework.csproj +++ b/src/UnitTests.Databases.SqlServer.EntityFramework/UnitTests.Databases.SqlServer.EntityFramework.csproj @@ -10,8 +10,11 @@ README.md MIT - 1.0.0 - - Initial version + 1.0.1 + - Fix the documentation + + 1.0.0 + - Initial version unittest entityframework sqlserver repository tdd dataaccesslayer diff --git a/src/UnitTests.Databases.SqlServer/UnitTests.Databases.SqlServer.csproj b/src/UnitTests.Databases.SqlServer/UnitTests.Databases.SqlServer.csproj index baad0ed..4030468 100644 --- a/src/UnitTests.Databases.SqlServer/UnitTests.Databases.SqlServer.csproj +++ b/src/UnitTests.Databases.SqlServer/UnitTests.Databases.SqlServer.csproj @@ -10,8 +10,11 @@ README.md MIT - 1.0.0 - - Initial version + 1.0.1 + - Fix the documentation + + 1.0.0 + - Initial version unittest sqlserver repository tdd dataaccesslayer