dot8code.Tests.MockHttpMessageHandler 1.0.0-prev6

This is a prerelease version of dot8code.Tests.MockHttpMessageHandler.
dotnet add package dot8code.Tests.MockHttpMessageHandler --version 1.0.0-prev6                
NuGet\Install-Package dot8code.Tests.MockHttpMessageHandler -Version 1.0.0-prev6                
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="dot8code.Tests.MockHttpMessageHandler" Version="1.0.0-prev6" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add dot8code.Tests.MockHttpMessageHandler --version 1.0.0-prev6                
#r "nuget: dot8code.Tests.MockHttpMessageHandler, 1.0.0-prev6"                
#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 dot8code.Tests.MockHttpMessageHandler as a Cake Addin
#addin nuget:?package=dot8code.Tests.MockHttpMessageHandler&version=1.0.0-prev6&prerelease

// Install dot8code.Tests.MockHttpMessageHandler as a Cake Tool
#tool nuget:?package=dot8code.Tests.MockHttpMessageHandler&version=1.0.0-prev6&prerelease                

MockHttpMessageHandler

Mocking an HTTP client in C# is important for several reasons. First, it can help you write more effective unit tests. By mocking the HTTP client, you can test your code without actually making any network requests. This can help you write faster tests that are less prone to failure.

Mocking an HTTP client can help you test your code in isolation. By mocking the HTTP client, you can test your code without worrying about external dependencies. This can help you write more reliable tests that are less prone to failure.

Mocking an HTTP client can help you test your code more thoroughly. By mocking the HTTP client, you can simulate different responses and error conditions. This can help you identify issues early on and avoid costly mistakes down the line.

In summary, mocking an HTTP client in C# is important for ensuring that your code works as expected, is maintainable, and is secure.

Installation

dotnet add package dot8code.Tests.MockHttpMessageHandler

Usage

Main class to mock HttpMessageHandler is FakeHttpMessageHandler this class is generic and we can provide any type of object for example string, int, YourClass.

    var mockedMessage = new FakeHttpMessageHandler<T>(expectedT, HttpStatusCode);
    var httpClient = new HttpClient(mockedMessage);

Basic Usage

    const HttpStatusCode expectedStatusCode = HttpStatusCode.OK;
    const string expectedResponse = "expected rsponse";

    var mockedMessage = new FakeHttpMessageHandler<string>(expectedResponse, expectedStatusCode);
    var httpClient = new HttpClient(mockedMessage);
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  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 was computed.  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 is compatible.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos 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
1.0.0-prev6 51 3/28/2024
1.0.0-prev5 48 3/28/2024
1.0.0-prev4 49 2/27/2024
1.0.0-prev3 76 6/20/2023
1.0.0-prev2 65 6/8/2023
1.0.0-prev17 52 4/3/2024
1.0.0-prev16 48 3/29/2024
1.0.0-prev15 42 3/29/2024
1.0.0-prev14 39 3/29/2024
1.0.0-prev1 65 6/7/2023