From 8ee4d8d8c6ff03a0ba294fa7892f0d8cf60f89c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Fija=C5=82kowski?= Date: Mon, 30 Dec 2024 12:34:17 +0100 Subject: [PATCH 1/4] Update README to the recent changes --- README.md | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 2089eceb..cfaa7a40 100644 --- a/README.md +++ b/README.md @@ -80,10 +80,10 @@ If you want to build release configuration of the library, you need to specify w ### Testing -The framework can be unit-tested by `cd`ing into `test` folder and calling +The framework can be unit-tested by running the following command in the root of the repository: ```sh -dotnet msbuild /t:RunTests +dotnet test ``` Moreover, there are some integration-style tests that require external services. They can be tested with `docker` and `docker-compose` tools. Currently there is one integration-test suite: @@ -93,7 +93,10 @@ Moreover, there are some integration-style tests that require external services. It has a `docker` folder that contains necessary configuration. You can run the suite using: ```sh -docker-compose run test +# For running tests with SQL Server +$ DB=sqlserver docker-compose run test +# For running tests with PostgreSQL +$ DB=postgres docker-compose run test ``` ### Publishing @@ -120,8 +123,7 @@ The project is divided into the main directories: 1. `src` with the source code, 2. `test` with test, - 3. `benchmarks` with benchmarking project, - 4. `docs` with this documentation. + 3. `docs` with this documentation. Plus there are some files in the root directory (SLN, config files & READMEs). @@ -142,7 +144,7 @@ The `src` folder that contains the main source code is then divided into: CoreLib build system mostly MSBuild-based, with some help of CI system to orchestrate build/test/publish process (see [Building & Testing](./building_and_testing.md) for more details). -We leverage .NET Core's MSBuild `Directory.Build.targets` files to centrally manage dependency versions. It is forbidden to directly specify `Version` in `csproj`s. Instead, one adds simple `` and then `` in `Directory.Build.targets` in the CoreLib root. This immensely helps avoiding dependency conflicts down the road. +We leverage [Central Package Management]'s `Directory.Packages.props` files to centrally manage dependency versions. It is forbidden to directly specify `Version` in `csproj`s. Besides `.targets` file, we use central `Directory.Build.props` to manage some of the project properties. Check [/Directory.Build.props], [/src/Directory.Build.props] and [/test/Directory.Build.props] what is being centrally set. @@ -160,7 +162,7 @@ Or you can just modify the following project template (most of the projects use ``` - +[Central Package Management]: https://learn.microsoft.com/en-us/nuget/consume-packages/central-package-management [/Directory.Build.props]: https://github.com/leancodepl/corelibrary/blob/HEAD/Directory.Build.props [/src/Directory.Build.props]: https://github.com/leancodepl/corelibrary/blob/HEAD/src/Directory.Build.props [/test/Directory.Build.props]: https://github.com/leancodepl/corelibrary/blob/HEAD/test/Directory.Build.props From 16ee240a47aad531ab4aa39ab51f62fef389aabb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Fija=C5=82kowski?= Date: Mon, 30 Dec 2024 14:43:58 +0100 Subject: [PATCH 2/4] Add missing entry to the changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a6116066..77dcb54a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ but this project DOES NOT adhere to [Semantic Versioning](http://semver.org/). * Remove LeanCode.IdentityServer.KeyVault * Remove LeanCode.ExternalIdentityProviders * Remove LeanCode.PdfRocket +* Remove StyleCop completely ## 8.1 From 3301f2dfdd79744f195d65b0a4276e6a8d04ffa7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Fija=C5=82kowski?= Date: Mon, 30 Dec 2024 15:02:51 +0100 Subject: [PATCH 3/4] Update integration tests docs to match xUnit v3 --- docs/tests/integration_tests/index.md | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/docs/tests/integration_tests/index.md b/docs/tests/integration_tests/index.md index 34a35645..78349627 100644 --- a/docs/tests/integration_tests/index.md +++ b/docs/tests/integration_tests/index.md @@ -63,6 +63,10 @@ public class ExampleAppTestApp : LeanCodeTestFactory { base.ConfigureWebHost(builder); + // Remember to set correct content root path. This is the easiest option. + builder.UseSolutionRelativeContentRoot( + "tests/ExampleApp.IntegrationTests/ExampleApp.IntegrationTests.csproj"); + builder.ConfigureServices(services => { // Incorporate a hosted service responsible for creating @@ -78,19 +82,6 @@ public class ExampleAppTestApp : LeanCodeTestFactory } ``` -Following `ItemGroup` must be added to the integration test project's `.csproj` file. This group facilitates the discovery of the content root for the web application being tested. - -```xml - - - -``` - ## Authentication handler The `TestAuthenticationHandler` manages user authentication and deserialization of `ClaimsPrincipal` objects for testing purposes. @@ -185,7 +176,7 @@ public class AuthenticatedExampleAppTestApp : ExampleAppTestApp public AuthenticatedExampleAppTestApp() { } - public override async Task InitializeAsync() + public override async ValueTask InitializeAsync() { AuthenticateAsTestSuperUser(); @@ -241,7 +232,7 @@ public class UnauthenticatedExampleAppTestApp : ExampleAppTestApp public HttpCommandsExecutor Command { get; private set; } = default!; public HttpOperationsExecutor Operation { get; private set; } = default!; - public override async Task InitializeAsync() + public override async ValueTaskTask InitializeAsync() { await base.InitializeAsync(); @@ -294,9 +285,9 @@ public class Tests : IAsyncLifetime Assert.Matches("^project_[0-7][0-9A-HJKMNP-TV-Z]{25}$", project.Id); } - public Task InitializeAsync() => app.InitializeAsync(); + public ValueTask InitializeAsync() => app.InitializeAsync(); - public Task DisposeAsync() => app.DisposeAsync().AsTask(); + public ValueTask DisposeAsync() => app.DisposeAsync(); } public static class ApiClientHelpers From 6dff86bdf5051fbff44c0f5518fd0c6a659fb47c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Fija=C5=82kowski?= Date: Mon, 30 Dec 2024 16:33:04 +0100 Subject: [PATCH 4/4] Fix the double-task typo in docs Co-authored-by: Patryk Pochmara --- docs/tests/integration_tests/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/tests/integration_tests/index.md b/docs/tests/integration_tests/index.md index 78349627..d8d77524 100644 --- a/docs/tests/integration_tests/index.md +++ b/docs/tests/integration_tests/index.md @@ -232,7 +232,7 @@ public class UnauthenticatedExampleAppTestApp : ExampleAppTestApp public HttpCommandsExecutor Command { get; private set; } = default!; public HttpOperationsExecutor Operation { get; private set; } = default!; - public override async ValueTaskTask InitializeAsync() + public override async ValueTask InitializeAsync() { await base.InitializeAsync();