Heleonix.Testing.NUnit 1.2.0

The library for writing tests in BDD and AAA style

There is a newer version of this package available.
See the version list below for details.
Install-Package Heleonix.Testing.NUnit -Version 1.2.0
dotnet add package Heleonix.Testing.NUnit --version 1.2.0
<PackageReference Include="Heleonix.Testing.NUnit" Version="1.2.0">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Heleonix.Testing.NUnit --version 1.2.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Heleonix.Testing

The library for writing tests in BDD and AAA styles

Install

https://www.nuget.org/packages/Heleonix.Testing.NUnit

AAA: Arrange Act Assert

Structure
using Heleonix.Testing.NUnit.Aaa;
using static Heleonix.Testing.NUnit.Aaa.AaaSpec;

[ComponentTest(Type = typeof(Component))]
public static class ComponentTests
{
    [MemberTest(Name = nameof(Component.Member))]
    public static void Member()
    {
        Arrange(() => { });

        Act(() => { });

        Teardown(() => { });

        When("the action #1 is executed", () =>
        {
            Arrange(() => { });

            Act(() => { });

            Teardown(() => { });

            Should("lead to the result #1", () => { });

            And("the condition #1 is true", () =>
            {
                Arrange(() => { });

                Act(() => { });

                Teardown(() => { });

                Should("lead to the result #2", () => { });
            });
        });
    }
}
Tests Output

AAA

BDD: Behavior Driven Development

Structure
using Heleonix.Testing.NUnit.Bdd;
using static Heleonix.Testing.NUnit.Bdd.BddSpec;

[Feature(Name = "Feature")]
OR
[Story(
    Id = "111",
    Summary = "The cool story",
    AsA = "Product owner",
    IWant = "a cool story",
    SoThat = "I earn a lot of money")]
public static class TheCoolStory
{
    [Scenario(Name = "Earn a lot of money")]
    public static void Scenario()
    {
        Given("the precondition #1", () =>
        {
            SetupEach(() => { });

            BeforeEach(() => { });

            AfterEach(() => { });

            CleanupEach(() => { });

            When("the action #1 is executed", () =>
            {
                SetupEach(() => { });

                BeforeEach(() => { });

                AfterEach(() => { });

                CleanupEach(() => { });

                Then("the result #1 happens", () => { });

                And("the condition #1 is true", () =>
                {
                    SetupEach(() => { });

                    BeforeEach(() => { });

                    AfterEach(() => { });

                    CleanupEach(() => { });

                    Then("the result #2 happens", () => { });
                });
            });

            And("condition #2 is true", () =>
            {
                SetupEach(() => { });

                BeforeEach(() => { });

                AfterEach(() => { });

                CleanupEach(() => { });

                When("the action #2 is executed", () =>
                {
                    SetupEach(() => { });

                    BeforeEach(() => { });

                    AfterEach(() => { });

                    CleanupEach(() => { });

                    Then("the result #3 happens", () => { });

                    And("the condition #3 is true", () =>
                    {
                        SetupEach(() => { });

                        BeforeEach(() => { });

                        AfterEach(() => { });

                        CleanupEach(() => { });

                        Then("the result #4 happens", () => { });
                    });
                });
            });
        });
    }
}
Tests Output

BDD

Heleonix.Testing

The library for writing tests in BDD and AAA styles

Install

https://www.nuget.org/packages/Heleonix.Testing.NUnit

AAA: Arrange Act Assert

Structure
using Heleonix.Testing.NUnit.Aaa;
using static Heleonix.Testing.NUnit.Aaa.AaaSpec;

[ComponentTest(Type = typeof(Component))]
public static class ComponentTests
{
    [MemberTest(Name = nameof(Component.Member))]
    public static void Member()
    {
        Arrange(() => { });

        Act(() => { });

        Teardown(() => { });

        When("the action #1 is executed", () =>
        {
            Arrange(() => { });

            Act(() => { });

            Teardown(() => { });

            Should("lead to the result #1", () => { });

            And("the condition #1 is true", () =>
            {
                Arrange(() => { });

                Act(() => { });

                Teardown(() => { });

                Should("lead to the result #2", () => { });
            });
        });
    }
}
Tests Output

AAA

BDD: Behavior Driven Development

Structure
using Heleonix.Testing.NUnit.Bdd;
using static Heleonix.Testing.NUnit.Bdd.BddSpec;

[Feature(Name = "Feature")]
OR
[Story(
    Id = "111",
    Summary = "The cool story",
    AsA = "Product owner",
    IWant = "a cool story",
    SoThat = "I earn a lot of money")]
public static class TheCoolStory
{
    [Scenario(Name = "Earn a lot of money")]
    public static void Scenario()
    {
        Given("the precondition #1", () =>
        {
            SetupEach(() => { });

            BeforeEach(() => { });

            AfterEach(() => { });

            CleanupEach(() => { });

            When("the action #1 is executed", () =>
            {
                SetupEach(() => { });

                BeforeEach(() => { });

                AfterEach(() => { });

                CleanupEach(() => { });

                Then("the result #1 happens", () => { });

                And("the condition #1 is true", () =>
                {
                    SetupEach(() => { });

                    BeforeEach(() => { });

                    AfterEach(() => { });

                    CleanupEach(() => { });

                    Then("the result #2 happens", () => { });
                });
            });

            And("condition #2 is true", () =>
            {
                SetupEach(() => { });

                BeforeEach(() => { });

                AfterEach(() => { });

                CleanupEach(() => { });

                When("the action #2 is executed", () =>
                {
                    SetupEach(() => { });

                    BeforeEach(() => { });

                    AfterEach(() => { });

                    CleanupEach(() => { });

                    Then("the result #3 happens", () => { });

                    And("the condition #3 is true", () =>
                    {
                        SetupEach(() => { });

                        BeforeEach(() => { });

                        AfterEach(() => { });

                        CleanupEach(() => { });

                        Then("the result #4 happens", () => { });
                    });
                });
            });
        });
    }
}
Tests Output

BDD

Release Notes

Added NUnit 3.9.0 as a dependency package

  • .NETFramework 4.5

  • .NETFramework 4.5.1

  • .NETFramework 4.5.2

  • .NETFramework 4.6

  • .NETFramework 4.6.1

  • .NETFramework 4.6.2

  • .NETStandard 1.6

  • .NETStandard 2.0

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
1.4.0 305 7/1/2018
1.3.0 243 6/30/2018
1.2.0 273 4/9/2018
1.1.1 292 3/28/2018
1.1.0 305 3/13/2018
1.0.0 346 1/28/2018