ConfirmSteps.Net 0.1.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package ConfirmSteps.Net --version 0.1.1                
NuGet\Install-Package ConfirmSteps.Net -Version 0.1.1                
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="ConfirmSteps.Net" Version="0.1.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ConfirmSteps.Net --version 0.1.1                
#r "nuget: ConfirmSteps.Net, 0.1.1"                
#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 ConfirmSteps.Net as a Cake Addin
#addin nuget:?package=ConfirmSteps.Net&version=0.1.1

// Install ConfirmSteps.Net as a Cake Tool
#tool nuget:?package=ConfirmSteps.Net&version=0.1.1                

ConfirmSteps.Net

ConfirmSteps.Net

Nuget Coverage Status

A simple testing suite to confirm the sequence of steps

What is ConfirmSteps.Net

ConfirmSteps.Net is a simple library to verify the correct sequence of steps with a focus on Rest APIs.

How do I get started?

Write a sequence of steps to confirm inside a unit test with your favorite testing framework:

    [Test]
    public async Task GettingStartedWithConfirmStepsNet()
    {
        // Arrange
        const string baseUrl = "{{url}}";
        Scenario<HttpScenarioData> scenario =
            Scenario.New<HttpScenarioData>("Getting started with ConfirmSteps.Net")
                .WithGlobals(e => e
                    .UseConst("url", "https://jsonplaceholder.typicode.com")
                    .UseObject("userId", d => d.UserId)
                )
                .WithSteps(s => s
                    // GET https://jsonplaceholder.typicode.com/users/1
                    .HttpStep("[Step-001-User-Read]",
                        () => RequestBuilder.Get(baseUrl).AppendPathSegments("users", "{{userId}}"),
                        step => step
                            .VerifyJson((response, _) =>
                            {
                                Assert.AreEqual(HttpStatusCode.OK, response.StatusCode);
                            })
                            .Extract(e => e
                                .ToVars("website", FromJsonBodyToString("$.website"))
                            )
                    )
                    .WaitStep(100, 200)
                    // POST https://jsonplaceholder.typicode.com/todos
                    .HttpStep("[Step-002-Todo-Add]",
                        () => RequestBuilder.Post(baseUrl).AppendPathSegment("todos")
                            .WithHeaders(h => h
                                .Header(HeaderNames.ContentType, MediaTypeNames.Application.Json)
                            )
                            .WithBody(
                                """
                                {
                                    "userId": {{userId}},
                                    "title": "Update home page of {{website}}",
                                    "completed": false
                                }
                                """
                            ),
                        step => step
                            .VerifyJson((response, _) =>
                            {
                                Assert.AreEqual(HttpStatusCode.Created, response.StatusCode);
                                Assert.AreEqual("Update home page of hildegard.org",
                                    response.SelectString("$.title"));
                            })
                            .Extract(e => e
                                .ToData(d => d.ToDoId!, FromJsonBodyToNumber("$.id"))
                            )
                    )
                )
                .Build()
            ;
        HttpScenarioData data = new()
        {
            UserId = 1,
        };

        // Act
        ConfirmStepResult<HttpScenarioData> confirmResult =
            await scenario.ConfirmSteps(data, CancellationToken.None);

        // Assert
        Assert.AreEqual(ConfirmStatus.Success, confirmResult.Status);
        Assert.AreEqual(201, confirmResult.Data.ToDoId);
    }

Where can I get it?

First, install NuGet. Then, install ConfirmSteps.Net from the package manager console:

PM> Install-Package ConfirmSteps.Net

Or from the .NET CLI as:

dotnet add package ConfirmSteps.Net

Do you have an issue?

If you're still running into problems, file an issue above.

License, etc.

ConfirmSteps.Net is Copyright © 2023 Grégory Célet and other contributors under the MIT license.

Motivation icons created by Freepik - Flaticon

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
0.1.2 218 8/15/2023
0.1.1 141 5/11/2023
0.1.0 145 5/9/2023

• Fixed bugs