Table of Contents

Interface IOperation

Namespace
Microsoft.Accordant
Assembly
Accordant.Operations.dll

Non-generic interface for operations, allowing type-erased storage in collections. This interface is implemented by Operation<TRequest, TResponse, TState>.

public interface IOperation
Extension Methods

Properties

DerivedFrom

The request derivations for this operation. Defines how this operation's requests can be derived from other operations' responses.

IReadOnlyList<RequestDerivation> DerivedFrom { get; }

Property Value

IReadOnlyList<RequestDerivation>

Name

The name of the operation.

string Name { get; }

Property Value

string

Polling

The polling setup for this operation. Defines how to poll for completion when this operation triggers a TerminatingStepFunction. The polling request is created using a derivation defined on the polling operation.

PollingSetup Polling { get; }

Property Value

PollingSetup

RequestType

The Type of the request sent to this operation.

Type RequestType { get; }

Property Value

Type

ResponseType

The Type of the response received from this operation.

Type ResponseType { get; }

Property Value

Type

Methods

ExecuteAsync(TestingContext, object)

Executes the operation against the system and returns the response. Error conditions such as exceptions, network timeouts, internal server errors etc should be converted to appropriate 'error' response objects and returned to the caller.

Task<object> ExecuteAsync(TestingContext context, object request)

Parameters

context TestingContext

The testing context.

request object

The request to execute.

Returns

Task<object>

The response from execution.

ExplainInvalidResponse(object, IState, object)

Returns an explanation of why the observed response did not match the expected response.

string ExplainInvalidResponse(object request, IState state, object observedResponse)

Parameters

request object
state IState
observedResponse object

Returns

string

ExplainInvalidResponse(object, StateProfile, object)

Returns an explanation of why the observed response did not match the expected response.

string ExplainInvalidResponse(object request, StateProfile stateProfile, object observedResponse)

Parameters

request object
stateProfile StateProfile
observedResponse object

Returns

string

Invoke(object, IState)

Returns all possible next states and optional step functions given a request and state.

IList<(object, StateProfile)> Invoke(object request, IState state)

Parameters

request object
state IState

Returns

IList<(object, StateProfile)>

Verify(object, IState, object)

Indicates whether the observed response is valid given the request and state. If valid, it also returns a (potentially) updated state as well as an optional step function that runs concurrently with the rest of the system.

(bool, StateProfile) Verify(object request, IState state, object observedResponse)

Parameters

request object
state IState
observedResponse object

Returns

(bool, StateProfile)

Verify(object, StateProfile, object)

Indicates whether the observed response is valid given the request and state profile. If valid, it also returns a (potentially) updated state as well as an optional step function that runs concurrently with the rest of the system.

(bool, StateProfile) Verify(object request, StateProfile stateProfile, object observedResponse)

Parameters

request object
stateProfile StateProfile
observedResponse object

Returns

(bool, StateProfile)

With(object, string)

Creates an OperationInput with the given request bound to this operation.

OperationInput With(object request, string label = null)

Parameters

request object

The request to bind.

label string

An optional label for the input.

Returns

OperationInput

An OperationInput instance.