| 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
Syntax public static Assertion ChangedTo(
this SmartAssertPlaceHolder _
)
<ExtensionAttribute>
Public Shared Function ChangedTo (
_ As SmartAssertPlaceHolder
) As Assertion
public:
[ExtensionAttribute]
static Assertion^ ChangedTo(
SmartAssertPlaceHolder^ _
)
[<ExtensionAttribute>]
static member ChangedTo :
_ : SmartAssertPlaceHolder -> Assertion
Parameters
- _
- Type: SmartTestsSmartAssertPlaceHolder
The dummy place holder for all Smart Assertions.
Return Value
Type:
AssertionThe 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 Exception | Condition |
---|
BadTestException | if the property/indexer value BEFORE the Act is the assigned value. |
SmartTestException | if the property/indexer value AFTER the Act is not the assigned value. |
Remarks Examples
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).
[Test]
public void MyPropertyTest_Set()
{
var mc = new MyClass();
RunTest( AnyValue.Valid,
Assign( () => mc.MyProperty, 10 ),
SmartAssert.ChangedTo() );
}
See Also