Skip to content

Instantly share code, notes, and snippets.

@deurell
Created June 19, 2010 19:27
Show Gist options
  • Save deurell/445203 to your computer and use it in GitHub Desktop.
Save deurell/445203 to your computer and use it in GitHub Desktop.
// Validate fired event
[Test(Description = "Verify that prop changed fires [Mikael Deurell]")]
public void Description_Changed_FiresPropertyChanged()
{
// Given the user wants to change the product description on a Product
int notify = 0;
var sut = new ProductViewModel();
sut.PropertyChanged += (sender, e) =>
{
if (e.PropertyName.Equals("Description"))
{
++notify;
}
};
// When changing the Description displayed in a text field on the view bound to the View Model
sut.Description = "new description";
// Then PropertyChangeEvent is fired in the View Model in order to let WPF notify the View of the change
Assert.That(notify, Is.EqualTo(1));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment