Class AspNetFixture
Fixture for testing ASP.NET Core based websites and services.
Implements
Inherited Members
Namespace: Neon.Xunit
Assembly: Neon.Xunit.dll
Syntax
public class AspNetFixture : TestFixture, ITestFixture
Constructors
AspNetFixture()
Constructs the fixture.
Declaration
public AspNetFixture()
Properties
BaseAddress
Returns the base URI for the running service.
Declaration
public Uri BaseAddress { get; }
Property Value
Type | Description |
---|---|
Uri |
HttpClient
Returns an HttpClient suitable for querying the service.
Declaration
public HttpClient HttpClient { get; }
Property Value
Type | Description |
---|---|
HttpClient |
JsonClient
Returns a JsonClient suitable for querying the service.
Declaration
public JsonClient JsonClient { get; }
Property Value
Type | Description |
---|---|
JsonClient |
WebHost
Returns the service's IWebHost.
Declaration
public IWebHost WebHost { get; }
Property Value
Type | Description |
---|---|
IWebHost |
Methods
Dispose(bool)
Releases all associated resources.
Declaration
protected override void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
bool | disposing | Pass |
Overrides
~AspNetFixture()
Finalizer.
Declaration
protected ~AspNetFixture()
Reset()
INTERNAL USE ONLY: Resets the fixture state.
Declaration
public override void Reset()
Overrides
Restart<TStartup>()
Restarts the web service.
Declaration
public void Restart<TStartup>() where TStartup : class
Type Parameters
Name | Description |
---|---|
TStartup | Specifies the web service startup class. |
StartAsComposed<TStartup>(Action<IWebHostBuilder>, int)
Used to start the fixture within a ComposedFixture.
Declaration
public void StartAsComposed<TStartup>(Action<IWebHostBuilder> hostConfigurator = null, int port = 0) where TStartup : class
Parameters
Type | Name | Description |
---|---|---|
Action<IWebHostBuilder> | hostConfigurator | Optional action providing for customization of the hosting environment. |
int | port | The port where the server will listen or zero to allow the operating system to select a free port. |
Type Parameters
Name | Description |
---|---|
TStartup | The startup class for the service. |
Start<TStartup>(Action<IWebHostBuilder>, int)
Starts the ASP.NET service using the default controller factory.
note
You'll need to call StartAsComposed<TStartup>(Action<IWebHostBuilder>, int) instead when this fixture is being added to a ComposedFixture.
Declaration
public void Start<TStartup>(Action<IWebHostBuilder> hostConfigurator = null, int port = 0) where TStartup : class
Parameters
Type | Name | Description |
---|---|---|
Action<IWebHostBuilder> | hostConfigurator | Optional action providing for customization of the hosting environment. |
int | port | The port where the server will listen or zero to allow the operating system to select a free port. |
Type Parameters
Name | Description |
---|---|
TStartup | The startup class for the service. |