bbv.LambdaTale 2.9.0-net462

This is a prerelease version of bbv.LambdaTale.
There is a newer version of this package available.
See the version list below for details.
dotnet add package bbv.LambdaTale --version 2.9.0-net462
                    
NuGet\Install-Package bbv.LambdaTale -Version 2.9.0-net462
                    
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="bbv.LambdaTale" Version="2.9.0-net462" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="bbv.LambdaTale" Version="2.9.0-net462" />
                    
Directory.Packages.props
<PackageReference Include="bbv.LambdaTale" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add bbv.LambdaTale --version 2.9.0-net462
                    
#r "nuget: bbv.LambdaTale, 2.9.0-net462"
                    
#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.
#:package bbv.LambdaTale@2.9.0-net462
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=bbv.LambdaTale&version=2.9.0-net462&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=bbv.LambdaTale&version=2.9.0-net462&prerelease
                    
Install as a Cake Tool

LambdaTale

LambdaTale NuGet version is a xUnit.net extension for describing each step in a test with natural language.

This is a fork of xBehave.net. Adam, thank you very much!

CI CodeQL Lint Spell check

Platform support: .NET Standard 2.0 and upwards.

Usage

Install the bbv.LambdaTale NuGet package and start using LambdaTale in your tests. LambdaTale can be used in two different ways: Through a string extension method or a static Spec() method. Both usages are described below.

String Extension Method

An example of using LambdaTale with the x() extension method is given below.

using System.Threading.Tasks;
using LambdaTale;

namespace Your.Tests;

public class SomeFeature
{
    public class OracleService
    {
        public Task<int> Run() => Task.FromResult(42);
    }

    [Scenario]
    public void SimpleDemo(int answer, OracleService sut)
    {
        "Given a magic oracle"
            .x(() => sut = new OracleService());

        "the answer"
            .x(async () => answer = await sut.Run());

        "is always known"
            .x(() => Xunit.Assert.Equal(42, answer));
    }
}

Static Spec Method

An example of using LambdaTale with a C# 6.0 using static directive and the static Spec() method is given below.

using System.Threading.Tasks;
using LambdaTale;
using static LambdaTale.Specifications;

namespace Your.Tests;

public class SomeFeature
{
    public class OracleService
    {
        public Task<int> Run() => Task.FromResult(42);
    }

    [Scenario]
    public void SimpleDemo(int answer, OracleService sut)
    {
        Spec("Given a magic oracle", () => sut = new OracleService());

        Spec("the answer", async () => answer = await sut.Run());

        Spec("is always known", () => Xunit.Assert.Equal(42, answer));
    }
}

Gotchas

The ITestOutputHelper will only write to test steps. Messages written before the first step (e.g. in the constructor, [Background], outside step definitions) will be logged as part of the first step, messages written after the last step (e.g. inside Dispose) will be logged as part of the last step.

Packages

The LambdaTale package depends on the xunit.core package. That means you get only the minimum dependencies required to write and execute LambdaTale scenarios.

Versions

LambdaTale follows the versioning scheme of xUnit.net. xUnit.net and LambdaTale do not follow SemVer and may introduce breaking changes in minor (or even patch) versions. Each minor version of LambdaTale is linked to the equivalent minor version of xUnit.net. The LambdaTale patch version is incremented to the next multiple of 100 each time it is linked to a new xUnit.net patch version. For example, LambdaTale 2.5.0 is linked with xUnit.net 2.5.0, and LambdaTale 2.5.100 is linked with xUnit 2.5.1.

A given LambdaTale patch version may introduce new features, fix bugs, or both.

Product Compatible and additional computed target framework versions.
.NET Framework net462 is compatible.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 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.