Class MockContext
- Namespace
- NMF.Transformations.Tests
- Assembly
- NMF.Transformations.dll
Represents a mock for the transformation context that does not execute any dependencies
public class MockContext : ITransformationContext
- Inheritance
-
MockContext
- Implements
- Inherited Members
- Extension Methods
Constructors
MockContext(Transformation)
Creates a new MockContext for the given transformation
public MockContext(Transformation transformation)
Parameters
transformation
TransformationThe transformation for which the mock context should be created
Exceptions
- ArgumentNullException
An ArgumentNullException is thrown whenever the transformation parameter is passed a null reference.
Properties
Bag
Gets a Bag, where dynamic data can be added
public dynamic Bag { get; }
Property Value
- dynamic
Remarks
The value of this property is an ExpandoObject, so that the bag can be easily extended with new properties
Computations
Gets all computations (for custom trace purposes)
public MockComputationCollection Computations { get; }
Property Value
Data
Gets a data dictionary, where data set during the transformation can be added
public IDictionary<object, object> Data { get; }
Property Value
Input
Gets the input of the transformation context
public object[] Input { get; set; }
Property Value
- object[]
Remarks
If the transformation has multiple inputs, this returns the first input
Inputs
Gets a collection of inputs
public IList<object[]> Inputs { get; }
Property Value
IsThreadSafe
Indicates whether the transformation context is thread-safe
public bool IsThreadSafe { get; }
Property Value
Output
Gets the output of the transformation context
public object Output { get; }
Property Value
Remarks
If the transformation has multiple outputs, this property returns the first output
Outputs
Gets a collection of outputs
public IList<object> Outputs { get; }
Property Value
Trace
Gets the object responsible for trace operations for this transformation context
public ITransformationTrace Trace { get; }
Property Value
Transformation
Gets the parent transformation, that the context is based upon
public Transformation Transformation { get; }
Property Value
Methods
CallTransformation(GeneralTransformationRule, object[])
Calls the given transformation with the specified input
public Computation CallTransformation(GeneralTransformationRule transformationRule, object[] input)
Parameters
transformationRule
GeneralTransformationRuleThe rule that should be applied
input
object[]The input for the transformation rule
Returns
- Computation
The computation that handles this request
CallTransformation(GeneralTransformationRule, object[], IEnumerable)
Calls the given transformation with the specified input
public virtual Computation CallTransformation(GeneralTransformationRule transformationRule, object[] input, IEnumerable context)
Parameters
transformationRule
GeneralTransformationRuleThe rule that should be applied
input
object[]The input for the transformation rule
context
IEnumerableThe context elements
Returns
- Computation
The computation that handles this request
CallTransformation<TIn>(GeneralTransformationRule<TIn>, TIn)
Calls the given transformation with the specified input
public Computation CallTransformation<TIn>(GeneralTransformationRule<TIn> transformationRule, TIn input) where TIn : class
Parameters
transformationRule
GeneralTransformationRule<TIn>The rule that should be applied
input
TInThe input for the transformation rule
Returns
- Computation
The computation that handles this request
Type Parameters
TIn
The type of the first input parameter
CallTransformation<TIn1, TIn2>(GeneralTransformationRule<TIn1, TIn2>, TIn1, TIn2)
Calls the given transformation with the specified input
public Computation CallTransformation<TIn1, TIn2>(GeneralTransformationRule<TIn1, TIn2> transformationRule, TIn1 input1, TIn2 input2) where TIn1 : class where TIn2 : class
Parameters
transformationRule
GeneralTransformationRule<TIn1, TIn2>The rule that should be applied
input1
TIn1The first input for the transformation rule
input2
TIn2The second input for the transformation rule
Returns
- Computation
The computation that handles this request
Type Parameters
TIn1
The type of the first input parameter
TIn2
The type of the second input parameter
ExecuteDependencies(Computation, bool)
Executes the dependencies of the given computation
public virtual void ExecuteDependencies(Computation computation, bool before)
Parameters
computation
ComputationThe computation whose dependencies should be executed
before
boolA value indicating whether the dependencies before the computation or the dependencies after the computation should be executed
RegisterComputationDependency(Computation, Computation, bool)
public void RegisterComputationDependency(Computation computation, Computation dependency, bool isRequired)
Parameters
computation
Computationdependency
ComputationisRequired
bool
Events
ComputationCompleted
Gets fired when a computation is done
public event EventHandler<ComputationEventArgs> ComputationCompleted