Class ExpectedOutcome
An expected outcome includes a response descriptor that can be used to verify whether the observed response from the system is valid or not, an update state as well as an optional step function that runs concurrently with the rest of the system.
public class ExpectedOutcome
- Inheritance
-
ExpectedOutcome
- Inherited Members
Constructors
ExpectedOutcome(ResponseValidator, IState, IStepFunction, Func<object>)
public ExpectedOutcome(ResponseValidator validator, IState updatedState, IStepFunction stepFunction, Func<object> mockResponse = null)
Parameters
validatorResponseValidatorupdatedStateIStatestepFunctionIStepFunctionmockResponseFunc<object>
ExpectedOutcome(ResponseValidator, IState, Func<object, StepFunctionList>, Func<object>)
public ExpectedOutcome(ResponseValidator validator, IState updatedState, Func<object, StepFunctionList> stepFunctionGenerator, Func<object> mockResponse = null)
Parameters
validatorResponseValidatorupdatedStateIStatestepFunctionGeneratorFunc<object, StepFunctionList>mockResponseFunc<object>
ExpectedOutcome(ResponseValidator, IState, Func<object>)
public ExpectedOutcome(ResponseValidator validator, IState updatedState, Func<object> mockResponse = null)
Parameters
validatorResponseValidatorupdatedStateIStatemockResponseFunc<object>
ExpectedOutcome(ResponseValidator, Func<object, IState, StateList>, IStepFunction, Func<object>)
public ExpectedOutcome(ResponseValidator validator, Func<object, IState, StateList> stateTransition, IStepFunction stepFunction, Func<object> mockResponse = null)
Parameters
validatorResponseValidatorstateTransitionFunc<object, IState, StateList>stepFunctionIStepFunctionmockResponseFunc<object>
ExpectedOutcome(ResponseValidator, Func<object, IState, StateList>, Func<object, StepFunctionList>, Func<object>)
Primary constructor - all other constructors normalize to this form.
public ExpectedOutcome(ResponseValidator validator, Func<object, IState, StateList> nextStateGenerator, Func<object, StepFunctionList> nextStepFunctions, Func<object> mockResponseGenerator = null)
Parameters
validatorResponseValidatornextStateGeneratorFunc<object, IState, StateList>nextStepFunctionsFunc<object, StepFunctionList>mockResponseGeneratorFunc<object>
ExpectedOutcome(ResponseValidator, Func<object, IState, StateList>, Func<object>)
public ExpectedOutcome(ResponseValidator validator, Func<object, IState, StateList> stateTransition, Func<object> mockResponse = null)
Parameters
validatorResponseValidatorstateTransitionFunc<object, IState, StateList>mockResponseFunc<object>
ExpectedOutcome(ResponseValidator, Func<object, StateList>, IStepFunction, Func<object>)
public ExpectedOutcome(ResponseValidator validator, Func<object, StateList> updatedStateGenerator, IStepFunction stepFunction, Func<object> mockResponse = null)
Parameters
validatorResponseValidatorupdatedStateGeneratorFunc<object, StateList>stepFunctionIStepFunctionmockResponseFunc<object>
ExpectedOutcome(ResponseValidator, Func<object, StateList>, Func<object, StepFunctionList>, Func<object>)
public ExpectedOutcome(ResponseValidator validator, Func<object, StateList> updatedStateGenerator, Func<object, StepFunctionList> stepFunctionGenerator, Func<object> mockResponse = null)
Parameters
validatorResponseValidatorupdatedStateGeneratorFunc<object, StateList>stepFunctionGeneratorFunc<object, StepFunctionList>mockResponseFunc<object>
ExpectedOutcome(ResponseValidator, Func<object, StateList>, Func<object>)
public ExpectedOutcome(ResponseValidator validator, Func<object, StateList> updatedStateGenerator, Func<object> mockResponse = null)
Parameters
Properties
MockResponseGenerator
A function that returns a mock response for state exploration.
public Func<object> MockResponseGenerator { get; }
Property Value
NextStateGenerator
A function that computes the next state(s) given the response and current state.
public Func<object, IState, StateList> NextStateGenerator { get; }
Property Value
NextStepFunctions
A function that computes step functions given the response. Returns empty list if no step functions are triggered.
public Func<object, StepFunctionList> NextStepFunctions { get; }
Property Value
Validator
The validator used to check whether the observed response satisfies the expected constraints or not.
public ResponseValidator Validator { get; }
Property Value
Methods
Explain(object)
Returns an explanation of why the observed response did not match this expected outcome.
public string Explain(object observedResponse)
Parameters
observedResponseobject
Returns
Matches(object, IState)
This method validates whether the observed response matches the expectation. If the observed response is valid, it returns the next state(s) and step function(s) as a StateProfile.
public (bool, StateProfile) Matches(object observedResponse, IState currentState)
Parameters
Returns
- (bool, StateProfile)
A tuple of (isValid, stateProfile).
Satisfies(object)
Checks if the observed response satisfies this expected outcome without computing the next state.
public bool Satisfies(object observedResponse)
Parameters
observedResponseobject
Returns
Operators
implicit operator ExpectedOutcomes(ExpectedOutcome)
public static implicit operator ExpectedOutcomes(ExpectedOutcome expectedResult)
Parameters
expectedResultExpectedOutcome