Show / Hide Table of Contents

Class MockContext

Represents a mock for the transformation context that does not execute any dependencies

Inheritance
object
MockContext
Implements
ITransformationContext
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: NMF.Transformations.Tests
Assembly: NMF.Transformations.dll
Syntax
public class MockContext : ITransformationContext

Constructors

| Edit this page View Source

MockContext(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 Source

Bag

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

| Edit this page View Source

Computations

Gets all computations (for custom trace purposes)

Declaration
public MockComputationCollection Computations { get; }
Property Value
Type Description
MockComputationCollection
| Edit this page View Source

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>
| Edit this page View Source

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

| Edit this page View Source

Inputs

Gets a collection of inputs

Declaration
public IList<object[]> Inputs { get; }
Property Value
Type Description
IList<object[]>
| Edit this page View Source

IsThreadSafe

Indicates whether the transformation context is thread-safe

Declaration
public bool IsThreadSafe { get; }
Property Value
Type Description
bool
| Edit this page View Source

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

| Edit this page View Source

Outputs

Gets a collection of outputs

Declaration
public IList<object> Outputs { get; }
Property Value
Type Description
IList<object>
| Edit this page View Source

Trace

Gets the object responsible for trace operations for this transformation context

Declaration
public ITransformationTrace Trace { get; }
Property Value
Type Description
ITransformationTrace
| Edit this page View Source

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 Source

CallTransformation(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

| Edit this page View Source

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

| Edit this page View Source

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

| Edit this page View Source

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

| Edit this page View Source

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

| Edit this page View Source

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 Source

ComputationCompleted

Gets fired when a computation is done

Declaration
public event EventHandler<ComputationEventArgs> ComputationCompleted
Event Type
Type Description
EventHandler<ComputationEventArgs>

Implements

ITransformationContext

Extension Methods

TransformationContextExtensions.CallTransformation(ITransformationContext, GeneralTransformationRule, params object[])
TraceExtensions.GetOrCreateUserItem<TValue>(ITransformationContext, object, Func<TValue>)
  • Edit this page
  • View Source
In this article
Back to top Generated by DocFX