Skip to content

Instantly share code, notes, and snippets.

@laurentkempe
Created November 13, 2012 12:58
Show Gist options
  • Save laurentkempe/4065637 to your computer and use it in GitHub Desktop.
Save laurentkempe/4065637 to your computer and use it in GitHub Desktop.
Fluent interface to test INotifyPropertyChanged sample usage
[Test]
public void BusinessUnit_SetToAValue_ExpectedPropertyChangedFired()
{
//Arrange
//Act
//Assert
_viewModel.Should()
.FirePropertyChangedOn(s => s.BusinessUnit)
.When(s => s.BusinessUnit = "Test2");
_viewModel.Should()
.FirePropertyChangedOn(s => s.BusinessUnit)
.HaveValueSetTo(s => s.BusinessUnit, "Test")
.When(s => s.BusinessUnit = "Test");
_viewModel.Should()
.HaveValueSetTo(s => s.BusinessUnit, "Test2")
.When(s => s.BusinessUnit = "Test2");
_viewModel.Should()
.FirePropertyChangedOn(vm => vm.BusinessUnit)
.SendMessage<ModelChangedMessage>()
.HaveValueSetTo(vm => vm.BusinessUnit, "Test")
.When(vm => vm.BusinessUnit = "Test");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment