コード例 #1
0
 public void EventShouldKnowWhatItIsBoundTo()
 {
     var testSubject = new TestableEvent<int>();
     testSubject.IsBoundTo(_Target).Should().BeFalse();
     testSubject.BindTo(_Target);
     testSubject.IsBoundTo(_Target).Should().BeTrue();
 }
コード例 #2
0
        public void EventShouldKnowWhatItIsBoundTo()
        {
            var testSubject = new TestableEvent <int>();

            testSubject.IsBoundTo(_Target).Should().BeFalse();
            testSubject.BindTo(_Target);
            testSubject.IsBoundTo(_Target).Should().BeTrue();
        }
コード例 #3
0
 public void EventShouldDifferentiateSameMethodWithDifferentTargets()
 {
     var testSubject = new TestableEvent<int>();
     var other = new HelperClassMakesEventSupportQuerying();
     testSubject.BindTo(_Target);
     testSubject.IsBoundTo(other._Target).Should().BeFalse();
 }
コード例 #4
0
        public void EventShouldDifferentiateFunctionsOnSameTarget()
        {
            var testSubject = new TestableEvent <int>();

            testSubject.BindTo(_Target);
            testSubject.IsBoundTo(_FalseTarget).Should().BeFalse();
        }
コード例 #5
0
        public void EventShouldDifferentiateSameMethodWithDifferentTargets()
        {
            var testSubject = new TestableEvent <int>();
            var other       = new HelperClassMakesEventSupportQuerying();

            testSubject.BindTo(_Target);
            testSubject.IsBoundTo(other._Target).Should().BeFalse();
        }
コード例 #6
0
 public void EventShouldSupportUnbinding()
 {
     var testSubject = new TestableEvent<int>();
     testSubject.BindTo(_Target);
     testSubject.Call(5);
     testSubject.UnbindFrom(_Target);
     testSubject.IsBoundTo(_Target).Should().BeFalse();
     testSubject.Call(9);
     _arg.Should().Be(5);
 }
コード例 #7
0
        public void EventShouldSupportUnbinding()
        {
            var testSubject = new TestableEvent <int>();

            testSubject.BindTo(_Target);
            testSubject.Call(5);
            testSubject.UnbindFrom(_Target);
            testSubject.IsBoundTo(_Target).Should().BeFalse();
            testSubject.Call(9);
            _arg.Should().Be(5);
        }
コード例 #8
0
 public void EventShouldDifferentiateFunctionsOnSameTarget()
 {
     var testSubject = new TestableEvent<int>();
     testSubject.BindTo(_Target);
     testSubject.IsBoundTo(_FalseTarget).Should().BeFalse();
 }