Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
# FEFF.TestFixtures

<p align="center">
<img src="docs/images/logo/logo.svg" alt="FEFF.TestFixtures Logo" width="200"/>
</p>

[![Test](https://github.com/metacoder-feff/FEFF.TestFixtures/actions/workflows/test.yml/badge.svg)](https://github.com/metacoder-feff/FEFF.TestFixtures/actions/workflows/test.yml)
[![Release](https://github.com/metacoder-feff/FEFF.TestFixtures/actions/workflows/release-nuget.yml/badge.svg)](https://github.com/metacoder-feff/FEFF.TestFixtures/actions/workflows/release-nuget.yml)

Integrations:
[![NuGet Version](https://img.shields.io/nuget/v/FEFF.TestFixtures.XunitV3?label=FEFF.TestFixtures.XunitV3)](https://www.nuget.org/packages/FEFF.TestFixtures.XunitV3)
[![NuGet Version](https://img.shields.io/nuget/v/FEFF.TestFixtures.TUnit?label=FEFF.TestFixtures.TUnit)](https://www.nuget.org/packages/FEFF.TestFixtures.TUnit)
[![NuGet Version](https://img.shields.io/nuget/v/FEFF.TestFixtures.XunitV4?label=FEFF.TestFixtures.XunitV4)](https://www.nuget.org/packages/FEFF.TestFixtures.XunitV4)
[![NuGet Version](https://img.shields.io/nuget/v/FEFF.TestFixtures.XunitV3?label=XunitV3)](https://www.nuget.org/packages/FEFF.TestFixtures.XunitV3)
[![NuGet Version](https://img.shields.io/nuget/v/FEFF.TestFixtures.TUnit?label=TUnit)](https://www.nuget.org/packages/FEFF.TestFixtures.TUnit)
[![NuGet Version](https://img.shields.io/nuget/v/FEFF.TestFixtures.XunitV4?label=XunitV4)](https://www.nuget.org/packages/FEFF.TestFixtures.XunitV4)

Fixture libraries:
[![NuGet Version](https://img.shields.io/nuget/v/FEFF.TestFixtures?label=FEFF.TestFixtures)](https://www.nuget.org/packages/FEFF.TestFixtures)
[![NuGet Version](https://img.shields.io/nuget/v/FEFF.TestFixtures.AspNetCore?label=FEFF.TestFixtures.AspNetCore)](https://www.nuget.org/packages/FEFF.TestFixtures.AspNetCore)
[![NuGet Version](https://img.shields.io/nuget/v/FEFF.TestFixtures.AspNetCore.EF?label=FEFF.TestFixtures.AspNetCore.EF)](https://www.nuget.org/packages/FEFF.TestFixtures.AspNetCore.EF)
[![NuGet Version](https://img.shields.io/nuget/v/FEFF.TestFixtures.AspNetCore.SignalR?label=FEFF.TestFixtures.AspNetCore.SignalR)](https://www.nuget.org/packages/FEFF.TestFixtures.AspNetCore.SignalR)
[![NuGet Version](https://img.shields.io/nuget/v/FEFF.TestFixtures.AspNetCore?label=AspNetCore)](https://www.nuget.org/packages/FEFF.TestFixtures.AspNetCore)
[![NuGet Version](https://img.shields.io/nuget/v/FEFF.TestFixtures.AspNetCore.EF?label=AspNetCore.EF)](https://www.nuget.org/packages/FEFF.TestFixtures.AspNetCore.EF)
[![NuGet Version](https://img.shields.io/nuget/v/FEFF.TestFixtures.AspNetCore.SignalR?label=AspNetCore.SignalR)](https://www.nuget.org/packages/FEFF.TestFixtures.AspNetCore.SignalR)

✅ Replace setup/teardown methods and test-class "Disposable pattern" with reusable **Fixtures**.
✅ Fixtures can depend on other fixtures.
Expand Down
29 changes: 16 additions & 13 deletions docs/articles/overview.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Overview

FEFF.TestFixtures is a testing library extension for .NET that replaces traditional setup/teardown methods or test-class "Disposable pattern" with reusable, composable fixtures.
![lLogo](../images/logo/logo.svg){width=250 height=120}

FEFF.TestFixtures is a .NET testing library extension that replaces traditional setup/teardown methods or the test-class "Disposable pattern" with reusable, composable fixtures.

## What is a Fixture?

Expand All @@ -16,19 +18,19 @@ A **fixture** is a reusable component that manages resources for testing purpose

FEFF.TestFixtures aims to:

✅ **Eliminate boilerplate** - Replace repetitive setup/teardown methods
✅ **Enable composition** - Build complex fixtures from simpler ones
✅ **Simplify ASP.NET Core testing** - Built-in fixtures for web applications
✅ **Maintain isolation** - Each test gets clean, predictable state
✅ **Eliminate boilerplate** Replace repetitive setup/teardown methods
✅ **Enable composition** Build complex fixtures from simpler ones
✅ **Simplify ASP.NET Core testing** Built-in fixtures for web applications
✅ **Maintain isolation** Each test gets clean, predictable state

Additionaly:
✅ **Support multiple frameworks** - Works with xUnit v3 and TUnit
Additionally:
✅ **Support multiple frameworks** Works with xUnit v3 and TUnit

## Key Concepts

### Fixtures

Fixtures are classes marked with the `[Fixture]` attribute. The framework discovers and manages their lifecycle automatically.
Fixtures are classes marked with the `[Fixture]` attribute. The framework automatically discovers and manages their lifecycle.

```csharp
[Fixture]
Expand All @@ -50,13 +52,13 @@ public class MyFixture : IDisposable

### Scopes

The **scope** of a fixture defines its lifetime. Within a scope, each fixture is created only once (lazily on demand) and destroyed at the end of the scope. If the fixture implements Dispose() or DisposeAsync(), those methods are called.
The **scope** of a fixture defines its lifetime. Within a scope, each fixture is created only once (lazily, on demand) and destroyed at the end of the scope. If the fixture implements `Dispose()` or `DisposeAsync()`, those methods are called.

The available scopes are defined by the test framework used. For **Xunit Integration**, they are:
`TestCase` , `Class`, `Collection`, `Assembly`
The available scopes are defined by the test framework used. For **xUnit Integration**, they are:
`TestCase`, `Class`, `Collection`, `Assembly`

For **TUnit Integration**, they are:
`TestCase` , `Class`, `Assembly`, `Session`
`TestCase`, `Class`, `Assembly`, `Session`

### Fixture Dependencies

Expand Down Expand Up @@ -110,4 +112,5 @@ Choose your path based on your needs:
| Quick setup with TUnit | [Quick Start (TUnit)](getting-started/quick-start-tunit.md) |
| Create your own fixture | [Creating Custom Fixtures](getting-started/creating-custom-fixtures.md) |
| Combine fixtures | [Fixture Dependencies](getting-started/fixture-dependencies.md) |
| Explore builtin fixtures | [Fixture List](fixtures/list.md) |
| Explore built-in fixtures | [Fixture List](fixtures/list.md) |
| Learn how to simplify ASP.NET Core application testing | [Tutorial](tutorials/asp-net-core-application-testing.md) |
7 changes: 3 additions & 4 deletions docs/articles/tutorials/asp-net-core-application-testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ using Microsoft.Extensions.Time.Testing;
using Newtonsoft.Json.Linq;
using Xunit.v3;

public class WeatherForecastApiTests
public class ApiTests
{
protected FixtureSet FixtureSet { get; } =
TestContext.Current.GetFeffFixture<FixtureSet>();
Expand Down Expand Up @@ -409,7 +409,6 @@ public class ApiTests
}
""");
}
#endregion

# region helpers

Expand Down Expand Up @@ -461,7 +460,7 @@ public class ApiTests
Execute the test from the command line:

```bash
dotnet test --filter "FullyQualifiedName~WeatherForecastApiTests"
dotnet test --filter "FullyQualifiedName~ApiTests"
```

The test should pass in a few seconds. Because all external factors (time, randomness, database name) are controlled by fixtures, the result is deterministic and repeatable.
Expand Down Expand Up @@ -499,7 +498,7 @@ You have now written integration tests that:
2. **Request the application** via an HTTP client.
3. **Inject configuration** before startup via `IAppConfigurator`.
4. **Control externalities** like time and randomness with `FakeTimeFixture` and `FakeRandomFixture`.
5. **Isolate data** across tests using `TmpDatabaseNameFixture`.
5. **Isolate data** across tests using `TmpDatabaseNameFixture` and `DatabaseLifecycleFixture`.
6. **Assert on persistence** by combining HTTP calls with direct `DbContext` queries.

## See Also
Expand Down
6 changes: 6 additions & 0 deletions docs/docfx.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,15 @@
"default",
"modern"
],
"markdownEngineProperties": {
"markdigExtensions": [
"attributes"
]
},
"globalMetadata": {
"_appName": "FEFF.TestFixtures Library Documentation",
"_appTitle": "FEFF.TestFixtures Library Documentation",
"_appLogoPath": "images/logo/logo-51-docfx.svg",
"_enableSearch": true,
"pdf": false
}
Expand Down
22 changes: 22 additions & 0 deletions docs/images/logo/Concept.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

The logo should represent one of these key ideas:
Interlocking / Reusable Blocks → "Fixtures" as modular components.


1.
Complete 2x2x2 cube structure (8 cubes total)
4 purple cubes + 4 teal cubes in alternating pattern
One of cubes is elevated (half-height raised) showing dynamic insertion
2-3 green check marks in one vertical column overlapping on the right side with Front-facing orientation (perpendicular to camera)
Professional 3D isometric view

2.
The "Interlocking Fixture Blocks"
What it is: 3 simple, slightly overlapping rounded squares (like Lego bricks). Two are dark gray (setup), one is green (test runs). An arrow loops from the last block back to the first, indicating teardown/reset.
Why it fits: Mirrors MyFixtureSet(F1, F2) dependencies – fixtures assembling into larger fixtures.
Color: Dark slate (#2D333B) + Emerald green (#2DA44E – GitHub's success green).

for github-repository's social media preview
convert docs/images/logo/logo.svg
to png with size 1280×640px
save as logo-1280-github.png
Binary file added docs/images/logo/logo-128-nuget.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/logo/logo-1280-github.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
129 changes: 129 additions & 0 deletions docs/images/logo/logo-51-docfx.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading