Table of Contents

Class FakeHttpRequestFeature

Namespace
Codebelt.Extensions.Xunit.Hosting.AspNetCore.Http.Features
Assembly
Codebelt.Extensions.Xunit.Hosting.AspNetCore.dll

Represents a way to support some default values for Request context..

public class FakeHttpRequestFeature : HttpRequestFeature, IHttpRequestFeature
Inheritance
FakeHttpRequestFeature
Implements
Inherited Members

Examples

The following example creates a FakeHttpRequestFeature to simulate the HTTP request metadata in a unit test. The feature provides settable properties for the HTTP method, path, query string, and request body, allowing complete control over the request characteristics.

using System;
using Codebelt.Extensions.Xunit.Hosting.AspNetCore.Http.Features;

namespace WebFixtureTests;

public class RequestFeatureExample
{
    public void Demonstrate()
    {
        var request = new FakeHttpRequestFeature();
        Console.WriteLine(request.Method);
    }
}

Constructors

FakeHttpRequestFeature()

Initializes a new instance of the FakeHttpRequestFeature class.

public FakeHttpRequestFeature()

See Also