Class Test
- Namespace
- Cuemon.Extensions.Xunit
- Assembly
- Cuemon.Extensions.Xunit.dll
Represents the base class from which all implementations of unit testing should derive.
public abstract class Test : Disposable, ITest, IDisposable
- Inheritance
-
ObjectTest
- Implements
-
IDisposable
- Derived
- Inherited Members
Constructors
Test(ITestOutputHelper, Type)
Initializes a new instance of the Test class.
protected Test(ITestOutputHelper output = null, Type callerType = null)
Parameters
output
ITestOutputHelperAn implementation of the Xunit.Abstractions.ITestOutputHelper interface.
callerType
TypeThe System.Type of caller that ends up invoking this instance.
Remarks
output
is initialized automatically in an xUnit project.
Properties
CallerType
Gets the type of caller for this instance. Default is System.Object.GetType.
public Type CallerType { get; }
Property Value
- Type
The type of caller for this instance.
HasTestOutput
Gets a value indicating whether TestOutput has a reference to an implementation of Xunit.Abstractions.ITestOutputHelper.
protected bool HasTestOutput { get; }
Property Value
- Boolean
true
if this instance has has a reference to an implementation of Xunit.Abstractions.ITestOutputHelper; otherwise,false
.
TestOutput
Gets the console substitute to write out unit test information.
protected ITestOutputHelper TestOutput { get; }
Property Value
- ITestOutputHelper
The console substitute to write out unit test information.
Methods
Match(String, String, Action<WildcardOptions>)
Provides a way, with wildcard support, to determine if actual
matches expected
.
public static bool Match(string expected, string actual, Action<WildcardOptions> setup = null)
Parameters
expected
StringThe expected string value.
actual
StringThe actual string value.
setup
Action<WildcardOptions>The WildcardOptions which may be configured.
Returns
- Boolean
true
ifactual
matchesexpected
,false
otherwise.
Remarks
Credits for inspiration goes to this SO answer: https://stackoverflow.com/questions/30299671/matching-strings-with-wildcard/30300521#30300521
Exceptions
- System.ArgumentOutOfRangeException
expected
cannot be matched withactual
. Includes the non-matched string(s) in System.ArgumentOutOfRangeException.ActualValue.
OnDisposeManagedResources()
Called when this object is being disposed by either Dispose() or Dispose(Boolean) having disposing
set to true
and Disposed is false
.
protected override void OnDisposeManagedResources()