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.7.0
Syntax
public static Assertion Within(
	this SmartAssertPlaceHolder _,
	long maximumDuration
)

Parameters

_
Type: SmartTestsSmartAssertPlaceHolder
The dummy place holder for all Smart Assertions.
maximumDuration
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).
Exceptions
ExceptionCondition
SmartTestException If the Act part of your test is longer than maximumDuration ms.
Remarks
For this assertion to be accurate, you have to put it as the first Smart Assertion.
Examples

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

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