Subatomix.Testing
3.1.0-rc.1
See the version list below for details.
dotnet add package Subatomix.Testing --version 3.1.0-rc.1
NuGet\Install-Package Subatomix.Testing -Version 3.1.0-rc.1
<PackageReference Include="Subatomix.Testing" Version="3.1.0-rc.1" />
paket add Subatomix.Testing --version 3.1.0-rc.1
#r "nuget: Subatomix.Testing, 3.1.0-rc.1"
// Install Subatomix.Testing as a Cake Addin #addin nuget:?package=Subatomix.Testing&version=3.1.0-rc.1&prerelease // Install Subatomix.Testing as a Cake Tool #tool nuget:?package=Subatomix.Testing&version=3.1.0-rc.1&prerelease
About
My preferred frameworks for automated testing in .NET.
See here for a list of included packages and their versions.
This package also includes the
TestHarnessBase
class, which aids my preferred technique for setup/teardown code. Generally, I
eschew traditional SetUp
and TearDown
methods. Instead, in each test, I
create an instance of a disposable context class. Construction is setup, and
disposal is teardown. Because TestContext
means something else already in
NUnit, I call this pattern Test Harness instead.
[Test]
public void TestSomething()
{
using var h = new TestHarness();
// rest of test
}
private class TestHarness : TestHarnessBase
{
// properties for mocks and things
public TestHarness()
{
// setup code
}
protected override CleanUp()
{
// teardown code
}
}
This pattern enables some cool things:
I can enable the C# 8 nullability checker and not have to sprinkle
?
and!
all over the test code.Tests can run in parallel, regardless of test fixture lifetime, since there is no longer any shared state within a test class.
Test-support code can be isolated away from the tests themselves.
If the
test fixture lifetime
is instance-per-test-case, the test fixture itself can be a subclass of
TestHarnessBase
. This results in a test fixture more closely resembling a
traditional one and removes the need for a using
statement in each test,
while retaining the improved nullability ergonomics. However, directly
subclassing TestHarnessBase
forfeits the isolation afforded by having a
separate test harness class.
[TestFixture]
public class SomeTests : TestHarnessBase
{
// properties for mocks and things
public TestHarness()
{
// setup code
}
protected override CleanUp()
{
// teardown code
}
[Test]
public void TestSomething()
{
// test
}
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Framework | net481 is compatible. |
-
.NETFramework 4.8.1
- coverlet.collector (>= 6.0.1 && < 7.0.0)
- FluentAssertions (>= 6.12.0 && < 7.0.0)
- Microsoft.NET.Test.Sdk (>= 17.9.0 && < 18.0.0)
- Moq (>= 4.20.70 && < 5.0.0)
- NUnit (>= 4.1.0 && < 5.0.0)
- NUnit3TestAdapter (>= 4.5.0 && < 5.0.0)
-
net6.0
- coverlet.collector (>= 6.0.1 && < 7.0.0)
- FluentAssertions (>= 6.12.0 && < 7.0.0)
- Microsoft.NET.Test.Sdk (>= 17.9.0 && < 18.0.0)
- Moq (>= 4.20.70 && < 5.0.0)
- NUnit (>= 4.1.0 && < 5.0.0)
- NUnit3TestAdapter (>= 4.5.0 && < 5.0.0)
-
net8.0
- coverlet.collector (>= 6.0.1 && < 7.0.0)
- FluentAssertions (>= 6.12.0 && < 7.0.0)
- Microsoft.NET.Test.Sdk (>= 17.9.0 && < 18.0.0)
- Moq (>= 4.20.70 && < 5.0.0)
- NUnit (>= 4.1.0 && < 5.0.0)
- NUnit3TestAdapter (>= 4.5.0 && < 5.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
3.1.0 | 186 | 3/11/2024 |
3.1.0-rc.1 | 60 | 3/9/2024 |
3.0.0 | 214 | 12/23/2023 |
3.0.0-rc.1 | 70 | 12/23/2023 |
2.6.0 | 173 | 9/24/2023 |
2.5.1 | 286 | 7/21/2023 |
2.5.1-rc.1 | 92 | 7/21/2023 |
2.5.0 | 309 | 6/3/2023 |
2.5.0-rc.1 | 92 | 6/1/2023 |
2.4.1 | 397 | 12/10/2022 |
2.4.0 | 338 | 11/13/2022 |
2.4.0-rc.2 | 104 | 11/12/2022 |
2.4.0-rc.1 | 102 | 11/12/2022 |
2.3.0 | 376 | 10/29/2022 |
2.3.0-rc.1 | 105 | 10/29/2022 |
2.2.0 | 532 | 6/12/2022 |
2.2.0-rc.1 | 128 | 6/12/2022 |
2.1.0 | 508 | 5/22/2022 |
2.1.0-rc.1 | 126 | 5/22/2022 |
2.0.1 | 587 | 5/2/2022 |
2.0.0 | 576 | 4/18/2022 |
2.0.0-rc.4 | 134 | 4/18/2022 |
2.0.0-rc.3 | 128 | 4/17/2022 |
2.0.0-rc.2 | 127 | 2/6/2022 |
1.1.5 | 555 | 9/27/2021 |
1.1.5-rc.2 | 150 | 9/27/2021 |
1.1.3 | 520 | 4/4/2021 |
1.1.2 | 502 | 3/7/2021 |
1.1.1 | 493 | 2/3/2021 |
1.1.0 | 516 | 1/22/2021 |
1.0.0 | 582 | 12/26/2020 |
1.0.0-rc.2 | 268 | 12/18/2020 |
1.0.0-rc.1 | 285 | 11/1/2020 |