Skip to content

WickedFlame/WorkflowValidation

Repository files navigation

Build status Build status

NuGet Version NuGet Version

Maintainability Rating Coverage

WorkflowValidation

Run Workflows step by step with inegrated Test Assertions. Test Workflows in BDD style.

Workflow.StartWith("Start step", c => { })
    .Then("Continue with step 2", c => { })
    .Then("And do step 3", c => { })
    .Run();

Using Extensions and Tools

using static WorkflowValidation.Tools.WorkflowTools;

StartWith("Start step", c => { })
    .Then("Continue with step 2", c => { })
    .Then("And do step 3", c => { })
    .Run();

The more complex way

using static WorkflowValidation.Tools.VerificationTools;
using static WorkflowValidation.Tools.StepTools;
using static WorkflowValidation.Tools.WorkflowTools;

Workflow<MyCustomContextType>(ctx =>
    StartWith(() =>
        {
            SetStep(b => b
                .SetName("Start Step")
                .Step(() => {
                    ctx.Message = "Workflow is started";
                })
            );

            Verify(b => b
                .SetName("Verify something")
                .Assert(() => !string.IsNullOrEmpty(ctx.Message))
            );

            SetStep(b => b
                .SetName("End Step")
                .Step(() => {
                    ctx.Message = "Workflow is ended";
                })
            );
        })
        .Then(() => { })
    )
    .Run();

public class MyCustomContextType
{
    public string Message { get; set; }
}