Class TestHarness
Provides capabilities to test services in an isolated runtime.
Inheritance
Implements
Namespace: Copper.Testing.Harness
Assembly: Copper.Testing.dll
Syntax
public class TestHarness : IDisposable
Constructors
View SourceTestHarness(IEnumerable<FabricHost>, ServiceProxy, EventsProxy, EventSubscriptionService, IEnumerable<EventHandler>)
Initializes a new instance of the TestHarness class.
Declaration
public TestHarness(IEnumerable<FabricHost> fabricHosts, ServiceProxy serviceProxy, EventsProxy eventsProxy, EventSubscriptionService eventSubscriptionService, IEnumerable<EventHandler> eventHandlers = null)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<FabricHost> | fabricHosts | The fabric hosts to run. |
ServiceProxy | serviceProxy | The service proxy, used to communicate with services. |
EventsProxy | eventsProxy | The events proxy, used to publish events. |
EventSubscriptionService | eventSubscriptionService | The event subscription service, used to subscribe to events. |
System.Collections.Generic.IEnumerable<EventHandler> | eventHandlers | The event handlers to be subscribed. |
Methods
View SourceDispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Declaration
public void Dispose()
Dispose(Boolean)
Releases unmanaged and - optionally - managed resources.
Declaration
protected virtual void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | disposing |
|
Run()
Runs the test harness, running the configured fabric hosts and subscribing the configured event handlers.
Declaration
public void Run()
RunAsync()
Runs the test harness, running the configured fabric hosts and subscribing the configured event handlers.
Declaration
public async Task RunAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
TestService<TContract>(IRequestSubmitterFactory, Func<TContract, Task>)
Tests the service by running the provided scenario.
Declaration
public async Task TestService<TContract>(IRequestSubmitterFactory requestSubmitterFactory, Func<TContract, Task> scenario)
where TContract : class
Parameters
Type | Name | Description |
---|---|---|
IRequestSubmitterFactory | requestSubmitterFactory | The request submitter factory. |
System.Func<TContract, System.Threading.Tasks.Task> | scenario | The scenario. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
Type Parameters
Name | Description |
---|---|
TContract | The contract type. |
TestService<TContract>(RequestSubmitterBuilder, Func<TContract, Task>)
Tests the service by running the provided scenario.
Declaration
public async Task TestService<TContract>(RequestSubmitterBuilder requestSubmitterBuilder, Func<TContract, Task> scenario)
where TContract : class
Parameters
Type | Name | Description |
---|---|---|
RequestSubmitterBuilder | requestSubmitterBuilder | The request submitter builder. |
System.Func<TContract, System.Threading.Tasks.Task> | scenario | The scenario. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
Type Parameters
Name | Description |
---|---|
TContract | The contract type. |
TestServiceEvents<TContract>(EventPublisherBuilder, Func<TContract, Task>)
Tests the impact of a published event by running the provided scenario.
Declaration
public async Task TestServiceEvents<TContract>(EventPublisherBuilder eventPublisherBuilder, Func<TContract, Task> scenario)
where TContract : class
Parameters
Type | Name | Description |
---|---|---|
EventPublisherBuilder | eventPublisherBuilder | The event publisher builder. |
System.Func<TContract, System.Threading.Tasks.Task> | scenario | The scenario. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
Type Parameters
Name | Description |
---|---|
TContract | The contract type. |
TestServiceEvents<TContract>(IEventPublisherFactory, Func<TContract, Task>)
Tests the impact of a published event by running the provided scenario.
Declaration
public async Task TestServiceEvents<TContract>(IEventPublisherFactory eventPublisherFactory, Func<TContract, Task> scenario)
where TContract : class
Parameters
Type | Name | Description |
---|---|---|
IEventPublisherFactory | eventPublisherFactory | The event publisher factory. |
System.Func<TContract, System.Threading.Tasks.Task> | scenario | The scenario. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
Type Parameters
Name | Description |
---|---|
TContract | The contract type. |