Click or drag to resize

PropertyChangedAssertionsNotRaised_PropertyChangedT Method (SmartAssertPlaceHolder, T, String)

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.9.0
public static Assertion NotRaised_PropertyChanged<T>(
	this SmartAssertPlaceHolder this,
	T instance,
	params string[] propertyNames
where T : INotifyPropertyChanged


Type: SmartTestsSmartAssertPlaceHolder
The dummy place holder for all Smart Assertions.
Type: T
The instance for which the property/indexer should change.
Type: SystemString
The names of the property/indexer that should not change.

Type Parameters

The type of the property/indexer that should not change.

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).
ArgumentNullException If instance is null.

If the INotifyPropertyChanged event is raised for the specified propertyNames.

This Assertion ensures that:
  1. Before the Act -

    Nothing special.

  2. During the Act -

    Ensures the PropertyChanged event is not raised for any of the specified propertyNames.

  3. After the Act -

    If the event is raised, a SmartTestException is thrown.

In this example, the Smart Assertion verifies that the PropertyChanged event is not raised for MyProperty nor OtherProperty, in any order.
public void MyMethodTest()
    var mc = new MyClass();
    RunTest( ValidValue.IsValid,
             () => mc.MyMethod(),
             SmartAssert.NotRaised_PropertyChanged( mc, nameof(MyClass.MyProperty), nameof(MyClass.OtherProperty) ) );
See Also