Click or drag to resize

ChangedToAssertionsChangedTo Method (SmartAssertPlaceHolder)

Creates an Assertion that ensure an object property/indexer changed in the Act part of your test.

Namespace:  SmartTests.Assertions
Assembly:  SmartTests (in SmartTests.dll) Version: 1.12.0
public static Assertion ChangedTo(
	this SmartAssertPlaceHolder _


Type: SmartTestsSmartAssertPlaceHolder
The dummy place holder for all Smart Assertions.

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).
BadTestExceptionif the property/indexer value BEFORE the Act is the assigned value.
SmartTestExceptionif the property/indexer value AFTER the Act is not the assigned value.
In this example, the Smart Assertion verifies that !Equals(mc.MyProperty,10) before the Act part of your test (otherwise a BadTestException is raised) and that Equals(mc.MyProperty,10) after the Act (otherwise a SmartTestException is raised).
public void MyPropertyTest_Set()
    var mc = new MyClass();

    RunTest( AnyValue.Valid,
             Assign( () => mc.MyProperty, 10 ),
             SmartAssert.ChangedTo() );
See Also