Share via


IBasicTestSite.Assume Method

Supports initialization requirements in a generated test class.

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

Usage

'Usage

Syntax

'Declaration
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

Generated test code does not call this method. However, the Assume method of the test manager calls the Assume method of the test site with which it was initialized. The test manager for the test is initialized in the InitializeTestManager method.

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.

A test class can call the DefaultTestManager.Assume 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

IBasicTestSite Interface
IBasicTestSite Members
Microsoft.SpecExplorer.Runtime.Testing Namespace
IBasicTestSite.Assert Method
IGeneratedTestClass.InitializeTestManager
DefaultTestManager.Assume Method

Other Resources

Test Code Generation Switches
Test Execution Switches