Поділитися через


FakeHost Class

Definition

Unit testing friendly configured host.

public ref class FakeHost sealed : IDisposable, Microsoft::Extensions::Hosting::IHost
public sealed class FakeHost : IDisposable, Microsoft.Extensions.Hosting.IHost
type FakeHost = class
    interface IHost
    interface IDisposable
Public NotInheritable Class FakeHost
Implements IDisposable, IHost
Inheritance
FakeHost
Implements

Properties

Services

Gets the program's configured services.

Methods

CreateBuilder()

Creates an instance of IHostBuilder to configure and build the host.

CreateBuilder(Action<FakeHostOptions>)

Creates an instance of IHostBuilder to configure and build the host.

CreateBuilder(FakeHostOptions)

Creates an instance of IHostBuilder to configure and build the host.

Dispose()

Disposes the IHost instance.

Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
StartAsync(CancellationToken)

Starts the program.

StopAsync(CancellationToken)

Attempts to gracefully stop the program.

ToString()

Returns a string that represents the current object.

(Inherited from Object)

Extension Methods

GetFakeLogCollector(IHost)

Gets the object that collects log records sent to the fake logger.

GetFakeRedactionCollector(IHost)

Gets the object reporting all redactions performed.

Run(IHost)

Runs an application and block the calling thread until host shutdown.

RunAsync(IHost, CancellationToken)

Runs an application and returns a Task that only completes when the token is triggered or shutdown is triggered. The host instance is disposed of after running.

Start(IHost)

Starts the host synchronously.

StopAsync(IHost, TimeSpan)

Attempts to gracefully stop the host with the given timeout.

WaitForShutdown(IHost)

Block the calling thread until shutdown is triggered via Ctrl+C or SIGTERM.

WaitForShutdownAsync(IHost, CancellationToken)

Returns a Task that completes when shutdown is triggered via the given token.

Applies to