| PropertyChangedAssertionsNotRaised_PropertyChangedT Method (SmartAssertPlaceHolder, ExpressionFuncT) |
Creates an
Assertion that ensure an object property/indexer did not change in the Act
part of your test.
Namespace:
SmartTests.Assertions
Assembly:
SmartTests (in SmartTests.dll) Version: 1.12.0
Syntax public static Assertion NotRaised_PropertyChanged<T>(
this SmartAssertPlaceHolder _,
Expression<Func<T>> expression
)
<ExtensionAttribute>
Public Shared Function NotRaised_PropertyChanged(Of T) (
_ As SmartAssertPlaceHolder,
expression As Expression(Of Func(Of T))
) As Assertion
public:
[ExtensionAttribute]
generic<typename T>
static Assertion^ NotRaised_PropertyChanged(
SmartAssertPlaceHolder^ _,
Expression<Func<T>^>^ expression
)
[<ExtensionAttribute>]
static member NotRaised_PropertyChanged :
_ : SmartAssertPlaceHolder *
expression : Expression<Func<'T>> -> Assertion
Parameters
- _
- Type: SmartTestsSmartAssertPlaceHolder
The dummy place holder for all Smart Assertions. - expression
- Type: System.Linq.ExpressionsExpressionFuncT
The expression involving an instance an a property/indexer that should not change.
Type Parameters
- T
- The type of the property/indexer that should not change.
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 Remarks
This
Assertion ensures that:
- Before the Act -
Nothing special.
- During the Act -
Ensures the PropertyChanged event is not raised for
the specified property in expression.
- After the Act -
If the event is raised, a SmartTestException is thrown.
Examples
In this example, the Smart Assertion verifies that the
PropertyChanged
event is not raised for
MyProperty.
[Test]
public void MyMethodTest()
{
var mc = new MyClass();
RunTest( ValidValue.IsValid,
() => mc.MyMethod(),
SmartAssert.NotRaised_PropertyChanged( () => mc.MyProperty ) );
}
See Also