dotMemory Unit 2.2 Help

Working with Unsupported Unit Testing Frameworks

If the unit testing framework you use is not supported by dotMemory Unit out of the box (see the list of supported frameworks), you can provide the support using the DotMemoryUnitController class.

All you need to do is to tell dotMemory Unit where your test method starts and where it ends. This is done by means of two methods: DotMemoryUnitController.TestStart() and DotMemoryUnitController.TestEnd(). We recommend that you create an IDisposable class* that uses these methods and then wrap the code in your tests with the using statement that creates an instance of this class.

Example

class DotMemoryUnit: IDisposable { public static IDisposable Support{get{return new DotMemoryUnit();}} private DotMemoryUnit() { DotMemoryUnitController.TestStart(); } public void Dispose() { DotMemoryUnitController.TestEnd(); } } public class Tests { [SomeTestAttribute] // an attribute that specifies a test in the framework of your choice public void TestMethod1() { using (DotMemoryUnit.Support) { ... // your code goes here } } }

DotMemoryUnitController Static Class

Allows providing dotMemory Unit with the support for any unit testing framework.

QueryBuilder Methods

NameDescription
TestStart() Indicates the start of a test.
TestEnd() Indicates the end of a test. Make sure this method is always called (even if a test throws an exception).
TestFailed() Indicates test failure. Call this method when handling an exception in your test. Usage of this method is required only if you use the [DotMemoryUnit(SavingStrategy = SavingStrategy.OnAnyFail)] option.
Last modified: 4 May 2016