Class Runner
Provides default implementation of runner that executes code decorated with Runnable/Run attributes.
This class IS NOT thread-safe
Inheritance
System.Object
Runner
Implements
System.IDisposable
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Assembly: NFX.dll
Syntax
public class Runner : DisposableObject, IDisposable
Constructors
Runner(Assembly, IRunnerHost, IConfigSectionNode)
Declaration
public Runner(Assembly asm, IRunnerHost host, IConfigSectionNode config)
Parameters
Fields
Assembly
Runs artifacts from this assembly
Declaration
public readonly Assembly Assembly
Field Value
Type |
Description |
System.Reflection.Assembly |
|
CONFIG_ARGS_SECTION
Declaration
public const string CONFIG_ARGS_SECTION = "args"
Field Value
Type |
Description |
System.String |
|
DELIMITERS
Declaration
public static readonly char[] DELIMITERS
Field Value
Type |
Description |
System.Char[] |
|
Host
Host which gets the output of runner
Declaration
public readonly IRunnerHost Host
Field Value
m_Args
Declaration
protected IConfigSectionNode m_Args
Field Value
m_ArgsResolver
Declaration
protected Runner.argsVarResolver m_ArgsResolver
Field Value
m_Categories
Declaration
protected string[] m_Categories
Field Value
Type |
Description |
System.String[] |
|
m_Methods
Declaration
protected string[] m_Methods
Field Value
Type |
Description |
System.String[] |
|
m_Names
Declaration
protected string[] m_Names
Field Value
Type |
Description |
System.String[] |
|
m_Namespaces
Declaration
protected string[] m_Namespaces
Field Value
Type |
Description |
System.String[] |
|
Properties
Args
Provides Runner instance arguments, default reads the sub-section of initial create args
Declaration
public virtual IConfigSectionNode Args { get; }
Property Value
Categories
If set, applies category filter fixtures and test methods in the specified categories.
Multiple categories are delimited by ',' or ';' or '|'
Declaration
[Config]
public string Categories { get; set; }
Property Value
Type |
Description |
System.String |
|
Emulate
If set, does not call method bodies, only preps for run but does not run methods
Declaration
[Config]
public bool Emulate { get; set; }
Property Value
Type |
Description |
System.Boolean |
|
Methods
If set filters the method names.
Multiple patterns delimited by ',' or ';' or '|'
Declaration
[Config]
public string Methods { get; set; }
Property Value
Type |
Description |
System.String |
|
Names
If set filters by method case names (attribute instance names).
Multiple patterns delimited by ',' or ';' or '|'
Declaration
[Config]
public string Names { get; set; }
Property Value
Type |
Description |
System.String |
|
Namespaces
If set filters the namespace names.
Multiple patterns delimited by ',' or ';' or '|'
Declaration
[Config]
public string Namespaces { get; set; }
Property Value
Type |
Description |
System.String |
|
Methods
FilterMethod(Type, MethodInfo, RunAttribute, Boolean)
Determines if the runnable should run in which case returns true.
Filter is based on this instance properties (such as Categories etc.)
Declaration
public virtual bool FilterMethod(Type tRunnable, MethodInfo mi, RunAttribute attr, bool runnableHasMethodLevelCategories)
Parameters
Type |
Name |
Description |
System.Type |
tRunnable |
|
System.Reflection.MethodInfo |
mi |
|
RunAttribute |
attr |
|
System.Boolean |
runnableHasMethodLevelCategories |
|
Returns
Type |
Description |
System.Boolean |
|
FilterRunnable(Type, RunnableAttribute)
Determines if the runnable should run in which case returns true.
Filter is based on this instance properties (such as Categories etc.)
Declaration
public virtual bool FilterRunnable(Type tRunnable, RunnableAttribute attr)
Parameters
Returns
Type |
Description |
System.Boolean |
|
GetRunMethods(Type)
Returns all run methods that satisfy filter (specified by this instance filter properties).
The enumeration is not ordered
Declaration
public virtual IEnumerable<> GetRunMethods(Type tRunnable)
Parameters
Type |
Name |
Description |
System.Type |
tRunnable |
|
Returns
Type |
Description |
System.Collections.Generic.IEnumerable<System.> |
|
GetRunnables()
Returns all runnables that satisfy filter (specified by this instance filter properties).
The enumeration is not ordered
Declaration
public virtual IEnumerable<> GetRunnables()
Returns
Type |
Description |
System.Collections.Generic.IEnumerable<System.> |
|
MakeMethodParameters()
Binds parameters supplied by RunAttribute into object[] as required by the supplied MethodInfo
Declaration
protected virtual object[] MakeMethodParameters(method)
Parameters
Type |
Name |
Description |
System. |
method |
|
Returns
Type |
Description |
System.Object[] |
|
Run()
Runs the methods. This default implementation is single-threaded sequential
Declaration
public virtual void Run()
RunAllMethods(FID, Object, IEnumerable<>)
Override to do parallel execution etc...
Declaration
protected virtual void RunAllMethods(FID id, object runnable, IEnumerable<> methods)
Parameters
Type |
Name |
Description |
FID |
id |
|
System.Object |
runnable |
|
System.Collections.Generic.IEnumerable<System.> |
methods |
|
SafeRunMethod(Object, )
Keep in mind this method may need to be thread-safe if RunAllMethods() is multi-threaded.
Should not throw execution errors
Declaration
protected virtual void SafeRunMethod(object runnable, method)
Parameters
Type |
Name |
Description |
System.Object |
runnable |
|
System. |
method |
|
Implements
System.IDisposable
Extension Methods