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 diff --git a/README.md b/README.md index d56cd1d..5f78f5b 100644 --- a/README.md +++ b/README.md @@ -63,25 +63,25 @@ 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. ## 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 diff --git a/docs/WriteUnitTests.md b/docs/WriteUnitTests.md index fd88634..e52a4cf 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) @@ -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. 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