Share via


GeneratedTestClassBase.Assume Method

When overridden in a derived class, supports initialization requirements in the generated test class.

Namespace: Microsoft.SpecExplorer.Runtime.Testing
Assembly: Microsoft.SpecExplorer.Runtime (in Microsoft.SpecExplorer.Runtime.dll)

Usage

'Usage

Syntax

'Declaration
public abstract void Assume (
    bool condition,
    string description
)

Parameters

  • condition
    The condition to assume true.
  • description
    The message to include in any exception that is thrown when condition is false.

Remarks

The generated test code does not call this method. However, the Assume method of the test manager calls the Assume method of the test class. The test manager for the test is initialized in the InitializeTestManager method.

Notes to Inheritors: Throw an exception to indicate that condition is false. If the TestMethodReturnType switch is set to none or "void", the TestPassedReturnValue, TestFailedReturnValue, and TestFailedExceptionType switches are ignored, and exceptions are not caught by the test case; that is, any exceptions generated by the test case are thrown to and handled by the test harness. If the TestMethodReturnType, TestPassedReturnValue, and TestFailedReturnValue switches are set to something other than their default values, each test case is wrapped in a try-catch block. If, in addition, the TestFailedExceptionType switch is set to a value other than none, each test case is wrapped in a try-catch block that catches only the specified exception type. Such exceptions specifically indicate that the test case encountered a conformance error, and the test manager raises such exceptions only if the test manager's ThrowTestFailureException property is set to true. You can call the DefaultTestManager.Assume method from your implementation of the InitializeTestManager method to check any initialization requirements that the test class might have.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Platforms

Development Platforms

Microsoft Windows 7, Microsoft Windows Vista, Microsoft Windows XP SP2 or later, Microsoft Windows Server 2008, Microsoft Windows Server 2003

See Also

Reference

GeneratedTestClassBase Class
GeneratedTestClassBase Members
Microsoft.SpecExplorer.Runtime.Testing Namespace
GeneratedTestClassBase.Assert Method
InitializeTestManager
DefaultTestManager.Assume Method

Other Resources

Test Code Generation Switches
Test Execution Switches