WhenResponse.RestSharp 1.0.0

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

WhenResponse

A simple library to make response treatment clean and fluent

Usage

response.When((r)=> r.StatusCode == HttpStatusCode.Ok,(r)=> System.Console.WriteLine("Ok"))
        .When((r)=> r.StatusCode == HttpStatusCode.Accepted,(r)=> System.Console.WriteLine("Accepted"))
        .When((r)=> r.StatusCode != HttpStatusCode.Accepted,(r)=> Assert.Fail("Waiting status code Accepted"));

Using it with RestSharp

var client = new RestClient("https://httpstat.us/");
var request = new RestRequest("202?sleep=2000", Method.GET);
          
// execute the request
IRestResponse response = client.Execute(request);
response.When((r)=> r.StatusCode == HttpStatusCode.Ok,(r)=> System.Console.WriteLine("Ok"))
        .When((r)=> r.StatusCode == HttpStatusCode.Accepted,(r)=> System.Console.WriteLine("Accepted"))
        .When((r)=> r.StatusCode == HttpStatusCode.NotFound,(r)=> Assert.Fail("No Found"));
Product Compatible and additional computed target framework versions.
.NET Framework net45 is compatible.  net451 was computed.  net452 was computed.  net46 was computed.  net461 was computed.  net462 was computed.  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.

Version Downloads Last Updated
2.0.0 1,118 8/23/2018
1.0.0 5,032 5/21/2018

A simple library to make response treatment clean and fluent