public void ApplyTo_SetterDoesNotRaiseEvent_True()
        {
            IRaisingSubject raising = Substitute.For<IRaisingSubject>();
            var subject = new NoPropertyChangingConstraint<IRaisingSubject>(raising);

            Assert.That(matches(subject, () => raising.I = 3), Is.True);
        }
Ejemplo n.º 2
0
        public void ApplyTo_SetterDoesNotRaiseEvent_True()
        {
            IRaisingSubject raising = Substitute.For <IRaisingSubject>();
            var             subject = new NoPropertyChangingConstraint <IRaisingSubject>(raising);

            Assert.That(matches(subject, () => raising.I = 3), Is.True);
        }
        public void ApplyTo_SetterRaisesEvent_False()
        {
            IRaisingSubject raising = Substitute.For<IRaisingSubject>();

            raising
                .When(r => r.I = Arg.Any<int>())
                .Do(ci => raising.PropertyChanging += Raise.Event<PropertyChangingEventHandler>(raising, new PropertyChangingEventArgs("anything")));

            var subject = new NoPropertyChangingConstraint<IRaisingSubject>(raising);
            Assert.That(matches(subject, () => raising.I = 3), Is.False);
        }
Ejemplo n.º 4
0
        public void ApplyTo_SetterRaisesEvent_False()
        {
            IRaisingSubject raising = Substitute.For <IRaisingSubject>();

            raising
            .When(r => r.I = Arg.Any <int>())
            .Do(ci => raising.PropertyChanging += Raise.Event <PropertyChangingEventHandler>(raising, new PropertyChangingEventArgs("anything")));

            var subject = new NoPropertyChangingConstraint <IRaisingSubject>(raising);

            Assert.That(matches(subject, () => raising.I = 3), Is.False);
        }
        public void WriteDescriptionTo_RaisesEvent_ExpectationWithEvent_ActualWithEventNotRaising()
        {
            IRaisingSubject raising = Substitute.For<IRaisingSubject>();
            raising
                .When(r => r.I = Arg.Any<int>())
                .Do(ci => raising.PropertyChanging += Raise.Event<PropertyChangingEventHandler>(raising, new PropertyChangingEventArgs("anything")));

            var subject = new NoPropertyChangingConstraint<IRaisingSubject>(raising);

            Assert.That(getMessage(subject, () => raising.I = 3),
                Does.StartWith(TextMessageWriter.Pfx_Expected + "event 'PropertyChanging' not raised").And
                    .Contain(TextMessageWriter.Pfx_Actual + "event 'PropertyChanging' raised"));
        }
Ejemplo n.º 6
0
        public void WriteDescriptionTo_RaisesEvent_ExpectationWithEvent_ActualWithEventNotRaising()
        {
            IRaisingSubject raising = Substitute.For <IRaisingSubject>();

            raising
            .When(r => r.I = Arg.Any <int>())
            .Do(ci => raising.PropertyChanging += Raise.Event <PropertyChangingEventHandler>(raising, new PropertyChangingEventArgs("anything")));

            var subject = new NoPropertyChangingConstraint <IRaisingSubject>(raising);

            Assert.That(getMessage(subject, () => raising.I = 3),
                        Does.StartWith(TextMessageWriter.Pfx_Expected + "event 'PropertyChanging' not raised").And
                        .Contain(TextMessageWriter.Pfx_Actual + "event 'PropertyChanging' raised"));
        }