| NotChangedAssertionsNotChangedExcept Method (SmartAssertPlaceHolder) |
Note: This API is now obsolete.
Creates an
Assertion that ensure object public properties did not change, except the one involved in
the Act part of your test.
Namespace:
SmartTests.Assertions
Assembly:
SmartTests (in SmartTests.dll) Version: 1.12.0
Syntax [ObsoleteAttribute("Use NotChangedExceptAct instead")]
public static Assertion NotChangedExcept(
this SmartAssertPlaceHolder _
)
<ExtensionAttribute>
<ObsoleteAttribute("Use NotChangedExceptAct instead")>
Public Shared Function NotChangedExcept (
_ As SmartAssertPlaceHolder
) As Assertion
public:
[ExtensionAttribute]
[ObsoleteAttribute(L"Use NotChangedExceptAct instead")]
static Assertion^ NotChangedExcept(
SmartAssertPlaceHolder^ _
)
[<ExtensionAttribute>]
[<ObsoleteAttribute("Use NotChangedExceptAct instead")>]
static member NotChangedExcept :
_ : 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 Act does not involve a property nor field.
|
SmartTestException |
If any public property, of the instance involved in the Act, except the property implied in the Act, have changed.
|
Remarks
This
Assertion ensures that:
- Before the Act -
If there is no public property involved in the Act, a BadTestException is thrown.
- After the Act -
If a public property changed during the Act (except the one involved in the Act itself), a
SmartTestException is thrown.
Examples
In this example, the Smart Assertion verifies that no public property of
mc, except
MyProperty
changed while assigning
MyProperty.
[Test]
public void CopyFromTest()
{
var mc = new MyClass();
RunTest( ValidValue.IsValid,
Assign( () => mc.MyProperty, 10 ),
SmartAssert.NotChangedExceptAct() );
}
See Also