StirlingLabs.Tests 23.3.4

Prefix Reserved
dotnet add package StirlingLabs.Tests --version 23.3.4                
NuGet\Install-Package StirlingLabs.Tests -Version 23.3.4                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="StirlingLabs.Tests" Version="23.3.4" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add StirlingLabs.Tests --version 23.3.4                
#r "nuget: StirlingLabs.Tests, 23.3.4"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install StirlingLabs.Tests as a Cake Addin
#addin nuget:?package=StirlingLabs.Tests&version=23.3.4

// Install StirlingLabs.Tests as a Cake Tool
#tool nuget:?package=StirlingLabs.Tests&version=23.3.4                

StirlingLabs.Tests

StirlingLabs.Tests is a lightweight test framework built for simplicity. It's designed to be easy to use, with a minimalistic approach to testing that focuses on simplicity and ease-of-use.

Features

  • Lightweight and easy to use
  • No need for attributes or class decorations
  • Injection of this pointer, TextWriter for logging, and CancellationToken for test cancellation signal via method parameters
  • Classes must be sealed and in a namespace that ends with .Tests or have a class name that ends with Tests
  • Class default constructors act as SetUp equivalents
  • Static class constructors act as OneTimeSetUp equivalents

Getting Started

To get started with StirlingLabs.Tests, simply install the NuGet package and add a reference to your test project. Then, define your tests as methods within a sealed class, in a namespace that ends with .Tests or has a class name that ends with Tests. Test methods may not be static.

namespace MyProject.Tests
{
    public sealed class MyTests
    {
        static MyTests()
        {
            // OneTimeSetUp equivalent
        }

        public MyTests()
        {
            // SetUp equivalent
        }

        public void MyTest1()
        {
            // test code
        }

        public void MyTest2(TextWriter logger)
        {
            // test code with logging
        }

        public void MyTest3(CancellationToken cancellationToken)
        {
            // test code with cancellation
        }

        public void MyTest4(TextWriter logger, CancellationToken cancellationToken)
        {
            // test code with logging and cancellation
        }
    }
}

Note that the parameters must be in the order specified, and may not be out of order.

The test method names must also be unique within the class. If you have multiple tests with the same name, you will get an error related to ambiguous method naming.

You can then run your tests using the built-in test runner, like this:

dotnet test MyProject.sln

Contributing

We welcome contributions from the community! If you find a bug or have a feature request, please open an issue on GitHub. If you'd like to contribute code, please fork the repository and submit a pull request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Product 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 is compatible.  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 was computed.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
23.3.4 768 3/2/2023
23.3.3 644 3/2/2023