public void ApplyTo_SetterDoesNotRaiseEvent_False() { IRaisingSubject raising = Substitute.For <IRaisingSubject>(); var subject = new PropertyChangedConstraint <IRaisingSubject>(raising, r => r.I); Assert.That(matches(subject, () => raising.I = 3), Is.False); }
public void ApplyTo_SetterDoesNotRaiseEvent_False() { IRaisingSubject raising = Substitute.For<IRaisingSubject>(); var subject = new PropertyChangedConstraint<IRaisingSubject>(raising, r => r.I); Assert.That(matches(subject, () => raising.I = 3), Is.False); }
public void WriteDescriptionTo_SetterDoesNotRaiseEvent_ExpectationWithEvent_PropertyName_ActualWithEventNotRaised() { IRaisingSubject raising = Substitute.For <IRaisingSubject>(); var subject = new PropertyChangedConstraint <IRaisingSubject>(raising, r => r.I); Assert.That(getMessage(subject, () => raising.I = 3), Does.StartWith(TextMessageWriter.Pfx_Expected + "raise event 'PropertyChanged'").And .Contain("PropertyName equal to \"I\"").And .Contain(TextMessageWriter.Pfx_Actual + "event 'PropertyChanged' not raised")); }
public void ApplyTo_RightPropertyName_True() { IRaisingSubject raising = Substitute.For<IRaisingSubject>(); raising .When(r => r.I = Arg.Any<int>()) .Do(ci => raising.PropertyChanged += Raise.Event<PropertyChangedEventHandler>(raising, new PropertyChangedEventArgs("I"))); var subject = new PropertyChangedConstraint<IRaisingSubject>(raising, r => r.I); Assert.That(matches(subject, () => raising.I = 3), Is.True); }
public void ApplyTo_RightPropertyName_True() { IRaisingSubject raising = Substitute.For <IRaisingSubject>(); raising .When(r => r.I = Arg.Any <int>()) .Do(ci => raising.PropertyChanged += Raise.Event <PropertyChangedEventHandler>(raising, new PropertyChangedEventArgs("I"))); var subject = new PropertyChangedConstraint <IRaisingSubject>(raising, r => r.I); Assert.That(matches(subject, () => raising.I = 3), Is.True); }
public void WriteDescriptionTo_WrongPropertyName_ActualWithOffendingValue() { IRaisingSubject raising = Substitute.For <IRaisingSubject>(); raising .When(r => r.I = Arg.Any <int>()) .Do(ci => raising.PropertyChanged += Raise.Event <PropertyChangedEventHandler>(raising, new PropertyChangedEventArgs("Wrong"))); var subject = new PropertyChangedConstraint <IRaisingSubject>(raising, r => r.I); Assert.That(getMessage(subject, () => raising.I = 3), Does.Contain(TextMessageWriter.Pfx_Actual + "\"Wrong\"")); }
public void WriteDescriptionTo_WrongPropertyName_ActualWithOffendingValue() { IRaisingSubject raising = Substitute.For<IRaisingSubject>(); raising .When(r => r.I = Arg.Any<int>()) .Do(ci => raising.PropertyChanged += Raise.Event<PropertyChangedEventHandler>(raising, new PropertyChangedEventArgs("Wrong"))); var subject = new PropertyChangedConstraint<IRaisingSubject>(raising, r => r.I); Assert.That(getMessage(subject, () => raising.I = 3), Does.Contain(TextMessageWriter.Pfx_Actual + "\"Wrong\"")); }
public void WriteDescriptionTo_SetterDoesNotRaiseEvent_ExpectationWithEvent_PropertyName_ActualWithEventNotRaised() { IRaisingSubject raising = Substitute.For<IRaisingSubject>(); var subject = new PropertyChangedConstraint<IRaisingSubject>(raising, r => r.I); Assert.That(getMessage(subject, () => raising.I = 3), Does.StartWith(TextMessageWriter.Pfx_Expected + "raise event 'PropertyChanged'").And .Contain("PropertyName equal to \"I\"").And .Contain(TextMessageWriter.Pfx_Actual + "event 'PropertyChanged' not raised")); }