public void SingleProperty_AssertPass() { var reportHeader = new ReportHeader(); reportHeader.ShouldNotifyFor(x => x.Report) .When(() => reportHeader.Report = "Setup Sheet"); }
public void NonPropertyExpression_Exception() { var reportHeader = new ReportHeader(); var ex = Assert.Throws <ArgumentException>(() => reportHeader.ShouldNotifyFor(x => "not a property expression")); Assert.That( ex.Message, Is.EqualTo("Expression must be a simple property access of the form \"x => x.PropertyName\".")); }
public void MultipleProperties_SingleNotification_AssertFail() { var reportHeader = new ReportHeader(); var ex = Assert.Throws <AssertionException>(() => reportHeader.ShouldNotifyFor(x => x.Customer) .And(x => x.Xml) .When(() => reportHeader.Customer = "Mick")); const string ExpectedMessage = "Expected PropertyChanged to fire for Xml Expectation met for Customer"; Assert.That( ex.Message, Is.EqualTo(ExpectedMessage)); }
public void SingleProperty_AssertFail() { var reportHeader = new ReportHeader(); var ex = Assert.Throws <AssertionException>(() => reportHeader.ShouldNotifyFor(x => x.Report) .When( () => { /* Do nothing so we expect an assert */ })); Assert.That( ex.Message, Is.EqualTo("Expected PropertyChanged to fire for Report")); }