AspNetCore.Simple.MsTest.Sdk 1.1.5

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

// Install AspNetCore.Simple.MsTest.Sdk as a Cake Tool
#tool nuget:?package=AspNetCore.Simple.MsTest.Sdk&version=1.1.5

AspNetCore.Simple.MsTest.Sdk

Target of this package is to write more efficient clean test against your ASP.Net Core API's. You will save tons of Assert and will be able to write even more faster and better readable test as before. Main reason was to be more focused on the Test-First approach.

Getting started

Prerequisites

Install the package

dotnet add package AspNetCore.Simple.MsTest.Sdk

Samples

Basic concept

// Those assert helper are smart they do following things:
// - Assser the expected call for Sucess -> AssertPostAsync -> Ok AssertPostAsErrorAsync -> NOK
// - It compares the complete reponse structure for equality -> Not only IsSuccessStatusCode, Also deep object 
// - You can provide json as string, or like here in the sample a json file which is embedded in the test assembly
// - Why json -> it is that fomat which is used for communication, and you can directly use your payloads in curl, 
//   postman or anywhere -> if you have c# code -> transform first into json, not nice to handle comparison
// - With this syntax you see directly the route which will be called
// - It is all made for maximize productivity

await Client.AssertPostAsync<AddUserReponse>($"api/v1/users/",                                                                        
                                             "Users.V1.Payloads.NewUser.json,
                                             "Users.V1.Results.NewUser.json);

Embedded json file or native json string

[TestMethod]
public Task Should_Return_No_Users_If_No_One_Was_Added()
{
    return Client.AssertGetAsync<GetAllUsersResponse>("v1/users", "EmptyUserResponse.json");
}
[TestMethod]
public Task Should_Return_No_Users_If_No_One_Was_Added()
{
    return Client.AssertGetAsync<GetAllUsersResponse>("v1/users", """{ "Users": [] }""");
}

Assert that GET all Users will returned 401 Unauthorized

[TestMethod]
public Task Should_Not_Return_All_Users_Without_Authentication()
{
    return Client.AssertGetAsUnauthorizedAsync("v1/users");
}

Assert that GET a user which not exists returns ProblemDetails

[TestMethod]
public Task Should_Return_Not_Found_Error_If_User_Does_Not_Exits()
{
    return Client.AssertGetAsErrorAsync<ProblemDetails>($"v1/users/{1234}", "UserGetByIdErrorResponse.json");
}

Assert that GET all Users is successful and checks that response is empty

[TestMethod]
public Task Should_Return_No_Users_If_No_One_Was_Added()
{
    return Client.AssertGetAsync<GetAllUsersResponse>("v1/users", "EmptyUserResponse.json");
}
Product Compatible and additional computed target framework versions.
.NET 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
3.0.1 53 4/29/2024
3.0.0 119 4/23/2024
2.0.2 417 4/7/2024
2.0.1 1,970 2/7/2024
2.0.0 2,957 11/28/2023
1.1.8 1,423 10/29/2023
1.1.7 60 10/29/2023
1.1.6 184 10/24/2023
1.1.5 4,863 7/20/2023
1.1.4 223 7/20/2023
1.1.3 1,720 5/31/2023
1.1.2 80 5/29/2023
1.1.1 732 5/20/2023
1.1.0 71 5/20/2023
1.0.9 1,553 4/30/2023
1.0.8 197 4/19/2023
1.0.7 83 4/18/2023
1.0.6 81 4/18/2023
1.0.5 1,165 3/23/2023
1.0.4 95 3/23/2023
1.0.3 3,722 1/1/2023
1.0.2 103 1/1/2023
1.0.1 93 1/1/2023
1.0.0 118 11/24/2022
0.7.0 1,825 11/21/2022
0.7.0-alpha.24 107 11/21/2022
0.7.0-alpha.23 2,174 10/23/2022
0.7.0-alpha.22 87 10/23/2022
0.7.0-alpha.20 155 10/20/2022
0.7.0-alpha.18 459 10/7/2022
0.7.0-alpha.16 104 10/3/2022
0.7.0-alpha.14 97 10/3/2022
0.7.0-alpha.13 102 10/3/2022
0.7.0-alpha.12 96 10/3/2022
0.7.0-alpha.11 88 10/3/2022
0.7.0-alpha.8 92 10/3/2022
0.7.0-alpha.7 97 10/3/2022
0.6.1 86 10/1/2022
0.6.0 65 10/1/2022
0.5.1 1,142 9/4/2022
0.5.0 69 9/4/2022
0.4.0 77 9/3/2022
0.3.1 103 8/24/2022
0.3.0 217 8/4/2022
0.2.0 191 7/25/2022
0.2.0-alpha.89 218 7/8/2022
0.2.0-alpha.87 106 7/8/2022
0.2.0-alpha.85 212 7/4/2022
0.2.0-alpha.83 166 6/30/2022
0.2.0-alpha.82 144 6/21/2022
0.2.0-alpha.81 256 6/19/2022
0.2.0-alpha.79 110 6/19/2022
0.2.0-alpha.77 219 5/25/2022
0.2.0-alpha.71 433 4/28/2022
0.2.0-alpha.70 291 3/11/2022
0.2.0-alpha.69 115 3/11/2022
0.2.0-alpha.68 965 7/2/2021
0.2.0-alpha.67 2,125 5/17/2021
0.2.0-alpha.66 688 4/26/2021
0.2.0-alpha.63 166 4/25/2021
0.2.0-alpha.54 306 4/22/2021
0.2.0-alpha.53 147 4/22/2021
0.2.0-alpha.51 175 4/20/2021
0.2.0-alpha.49 237 4/18/2021
0.2.0-alpha.48 191 4/18/2021
0.2.0-alpha.47 151 4/18/2021
0.2.0-alpha.46 138 4/17/2021
0.2.0-alpha.45 143 4/17/2021
0.2.0-alpha.44 146 4/17/2021
0.2.0-alpha.43 155 4/17/2021
0.1.0-alpha.39 152 4/17/2021
0.1.0-alpha.37 161 4/17/2021
0.1.0-alpha.35 167 4/17/2021
0.1.0-alpha.34 168 4/17/2021
0.1.0-alpha.31 161 4/16/2021
0.1.0-alpha.30 174 4/14/2021
0.1.0-alpha.29 143 4/14/2021
0.1.0-alpha.28 228 4/10/2021
0.1.0-alpha.20 156 4/9/2021
0.1.0-alpha.18 160 4/9/2021
0.1.0-alpha.17 179 4/9/2021
0.1.0-alpha.16 184 4/9/2021
0.1.0-alpha.14 159 4/9/2021
0.1.0-alpha.13 155 4/8/2021
0.1.0-alpha.12 343 4/5/2021

Add possibility to set objects as payload for Post, Put and Patch http assert calls