Class MockContext
Represents a mock for the transformation context that does not execute any dependencies
Implements
Inherited Members
Namespace: NMF.Transformations.Tests
Assembly: NMF.Transformations.dll
Syntax
public class MockContext : ITransformationContext
Constructors
| Edit this page View SourceMockContext(Transformation)
Creates a new MockContext for the given transformation
Declaration
public MockContext(Transformation transformation)
Parameters
Type | Name | Description |
---|---|---|
Transformation | transformation | The transformation for which the mock context should be created |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | An ArgumentNullException is thrown whenever the transformation parameter is passed a null reference. |
Properties
| Edit this page View SourceBag
Gets a Bag, where dynamic data can be added
Declaration
public dynamic Bag { get; }
Property Value
Type | Description |
---|---|
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)
Declaration
public MockComputationCollection Computations { get; }
Property Value
Type | Description |
---|---|
MockComputationCollection |
Data
Gets a data dictionary, where data set during the transformation can be added
Declaration
public IDictionary<object, object> Data { get; }
Property Value
Type | Description |
---|---|
IDictionary<object, object> |
Input
Gets the input of the transformation context
Declaration
public object[] Input { get; set; }
Property Value
Type | Description |
---|---|
object[] |
Remarks
If the transformation has multiple inputs, this returns the first input
Inputs
Gets a collection of inputs
Declaration
public IList<object[]> Inputs { get; }
Property Value
Type | Description |
---|---|
IList<object[]> |
IsThreadSafe
Indicates whether the transformation context is thread-safe
Declaration
public bool IsThreadSafe { get; }
Property Value
Type | Description |
---|---|
bool |
Output
Gets the output of the transformation context
Declaration
public object Output { get; }
Property Value
Type | Description |
---|---|
object |
Remarks
If the transformation has multiple outputs, this property returns the first output
Outputs
Gets a collection of outputs
Declaration
public IList<object> Outputs { get; }
Property Value
Type | Description |
---|---|
IList<object> |
Trace
Gets the object responsible for trace operations for this transformation context
Declaration
public ITransformationTrace Trace { get; }
Property Value
Type | Description |
---|---|
ITransformationTrace |
Transformation
Gets the parent transformation, that the context is based upon
Declaration
public Transformation Transformation { get; }
Property Value
Type | Description |
---|---|
Transformation |
Methods
| Edit this page View SourceCallTransformation(GeneralTransformationRule, object[])
Calls the given transformation with the specified input
Declaration
public Computation CallTransformation(GeneralTransformationRule transformationRule, object[] input)
Parameters
Type | Name | Description |
---|---|---|
GeneralTransformationRule | transformationRule | The rule that should be applied |
object[] | input | The input for the transformation rule |
Returns
Type | Description |
---|---|
Computation | The computation that handles this request |
CallTransformation(GeneralTransformationRule, object[], IEnumerable)
Calls the given transformation with the specified input
Declaration
public virtual Computation CallTransformation(GeneralTransformationRule transformationRule, object[] input, IEnumerable context)
Parameters
Type | Name | Description |
---|---|---|
GeneralTransformationRule | transformationRule | The rule that should be applied |
object[] | input | The input for the transformation rule |
IEnumerable | context | The context elements |
Returns
Type | Description |
---|---|
Computation | The computation that handles this request |
CallTransformation<TIn>(GeneralTransformationRule<TIn>, TIn)
Calls the given transformation with the specified input
Declaration
public Computation CallTransformation<TIn>(GeneralTransformationRule<TIn> transformationRule, TIn input) where TIn : class
Parameters
Type | Name | Description |
---|---|---|
GeneralTransformationRule<TIn> | transformationRule | The rule that should be applied |
TIn | input | The input for the transformation rule |
Returns
Type | Description |
---|---|
Computation | The computation that handles this request |
Type Parameters
Name | Description |
---|---|
TIn | The type of the first input parameter |
CallTransformation<TIn1, TIn2>(GeneralTransformationRule<TIn1, TIn2>, TIn1, TIn2)
Calls the given transformation with the specified input
Declaration
public Computation CallTransformation<TIn1, TIn2>(GeneralTransformationRule<TIn1, TIn2> transformationRule, TIn1 input1, TIn2 input2) where TIn1 : class where TIn2 : class
Parameters
Type | Name | Description |
---|---|---|
GeneralTransformationRule<TIn1, TIn2> | transformationRule | The rule that should be applied |
TIn1 | input1 | The first input for the transformation rule |
TIn2 | input2 | The second input for the transformation rule |
Returns
Type | Description |
---|---|
Computation | The computation that handles this request |
Type Parameters
Name | Description |
---|---|
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
Declaration
public virtual void ExecuteDependencies(Computation computation, bool before)
Parameters
Type | Name | Description |
---|---|---|
Computation | computation | The computation whose dependencies should be executed |
bool | before | A value indicating whether the dependencies before the computation or the dependencies after the computation should be executed |
RegisterComputationDependency(Computation, Computation, bool)
Declaration
public void RegisterComputationDependency(Computation computation, Computation dependency, bool isRequired)
Parameters
Type | Name | Description |
---|---|---|
Computation | computation | |
Computation | dependency | |
bool | isRequired |
Events
| Edit this page View SourceComputationCompleted
Gets fired when a computation is done
Declaration
public event EventHandler<ComputationEventArgs> ComputationCompleted
Event Type
Type | Description |
---|---|
EventHandler<ComputationEventArgs> |