Click or drag to resize

WithinAssertionsWithin Method (SmartAssertPlaceHolder, Int64)

Creates an Assertion that ensure the Act is done within a specific duration.

Namespace:  SmartTests.Assertions
Assembly:  SmartTests (in SmartTests.dll) Version: 1.10.0
public static Assertion Within(
	this SmartAssertPlaceHolder _,
	long maximumDuration


Type: SmartTestsSmartAssertPlaceHolder
The dummy place holder for all Smart Assertions.
Type: SystemInt64
The maximum allowed duration of the Act.

Return Value

Type: Assertion
The newly created Assertion.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type SmartAssertPlaceHolder. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
SmartTestException If the Act part of your test is longer than maximumDuration ms.
For this assertion to be accurate, you have to put it as the first Smart Assertion.

In this example, the Smart Assertion verifies that the MyMethod call takes no longer than 10ms.

public void MyMethodTest()
    var mc = new MyClass();
    RunTest( ValidValue.IsValid,
             () => mc.MyMethod(),
             SmartAssert.Within(10) );
See Also