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)
Assembly: Azos.dll
Syntax
public class Runner : ApplicationComponent, IDisposable, IApplicationComponent
Constructors
Runner(IRunnerHost, Assembly, IConfigSectionNode)
Declaration
public Runner(IRunnerHost host, Assembly asm, IConfigSectionNode config)
Parameters
Fields
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[] |
|
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
Assembly
Runs artifacts from this assembly
Declaration
public Assembly Assembly { get; }
Property Value
Type |
Description |
System.Reflection.Assembly |
|
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 |
|
ComponentLogTopic
Declaration
public override string ComponentLogTopic { get; }
Property Value
Type |
Description |
System.String |
|
Overrides
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 |
|
Host
Host which gets the output of runner
Declaration
public IRunnerHost Host { get; }
Property Value
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<(MethodInfo mi, RunAttribute attr)> GetRunMethods(Type tRunnable)
Parameters
Type |
Name |
Description |
System.Type |
tRunnable |
|
Returns
Type |
Description |
System.Collections.Generic.IEnumerable<System.ValueTuple<System.Reflection.MethodInfo, RunAttribute>> |
|
GetRunnables()
Returns all runnables that satisfy filter (specified by this instance filter properties).
The enumeration is not ordered
Declaration
public virtual IEnumerable<(Type t, RunnableAttribute attr)> GetRunnables()
Returns
Type |
Description |
System.Collections.Generic.IEnumerable<System.ValueTuple<System.Type, RunnableAttribute>> |
|
MakeMethodParameters((MethodInfo m, RunAttribute a))
Binds parameters supplied by RunAttribute into object[] as required by the supplied MethodInfo
Declaration
protected virtual object[] MakeMethodParameters((MethodInfo m, RunAttribute a)method)
Parameters
Type |
Name |
Description |
System.ValueTuple<System.Reflection.MethodInfo, RunAttribute> |
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<(MethodInfo mi, RunAttribute attr)>)
Override to do parallel execution etc...
Declaration
protected virtual void RunAllMethods(FID id, object runnable, IEnumerable<(MethodInfo mi, RunAttribute attr)> methods)
Parameters
Type |
Name |
Description |
FID |
id |
|
System.Object |
runnable |
|
System.Collections.Generic.IEnumerable<System.ValueTuple<System.Reflection.MethodInfo, RunAttribute>> |
methods |
|
SafeRunMethod(Object, (MethodInfo mi, RunAttribute attr))
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, (MethodInfo mi, RunAttribute attr)method)
Parameters
Type |
Name |
Description |
System.Object |
runnable |
|
System.ValueTuple<System.Reflection.MethodInfo, RunAttribute> |
method |
|
Implements
System.IDisposable
Extension Methods