Skip to content

Commit

Permalink
Merge pull request #734 from leancodepl/update-readme
Browse files Browse the repository at this point in the history
Update README to the recent changes
  • Loading branch information
jakubfijalkowski authored Dec 30, 2024
2 parents 29b6ab3 + 6dff86b commit d54cf21
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 24 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
16 changes: 9 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand All @@ -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).

Expand All @@ -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 `<ProjectReference Include="NAME" />` and then `<ProjectReference Update="NAME" Version="VALID_VERSION" />` 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.

Expand All @@ -160,7 +162,7 @@ Or you can just modify the following project template (most of the projects use

</Project>
```

[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
25 changes: 8 additions & 17 deletions docs/tests/integration_tests/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ public class ExampleAppTestApp : LeanCodeTestFactory<Startup>
{
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
Expand All @@ -78,19 +82,6 @@ public class ExampleAppTestApp : LeanCodeTestFactory<Startup>
}
```

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
<ItemGroup>
<WebApplicationFactoryContentRootAttribute
Include="ExampleApp.IntegrationTests"
AssemblyName="ExampleApp.IntegrationTests"
ContentRootPath="$(MSBuildProjectDirectory)"
ContentRootTest="ExampleApp.IntegrationTests.csproj"
Priority="-1" />
</ItemGroup>
```

## Authentication handler

The `TestAuthenticationHandler` manages user authentication and deserialization of `ClaimsPrincipal` objects for testing purposes.
Expand Down Expand Up @@ -185,7 +176,7 @@ public class AuthenticatedExampleAppTestApp : ExampleAppTestApp

public AuthenticatedExampleAppTestApp() { }

public override async Task InitializeAsync()
public override async ValueTask InitializeAsync()
{
AuthenticateAsTestSuperUser();

Expand Down Expand Up @@ -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 ValueTask InitializeAsync()
{
await base.InitializeAsync();

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit d54cf21

Please sign in to comment.