public void AcceptNullVisitorThrows()
 {
     // Fixture setup
     var sut = new EventInfoElement(TypeWithEvent.LocalEvent);
     // Exercise system
     // Verify outcome
     Assert.Throws<ArgumentNullException>(() =>
         sut.Accept((IReflectionVisitor<object>)null));
     // Teardown
 }
Exemple #2
0
        public void AcceptNullVisitorThrows()
        {
            // Fixture setup
            var sut = new EventInfoElement(TypeWithEvents.LocalEvent);

            // Exercise system
            // Verify outcome
            Assert.Throws <ArgumentNullException>(() =>
                                                  sut.Accept((IReflectionVisitor <object>)null));
            // Teardown
        }
        public void AcceptCallsTheCorrectVisitorMethodAndReturnsTheCorrectInstance()
        {
            // Fixture setup
            var expected = new DelegatingReflectionVisitor<int>();
            var sut = new EventInfoElement(TypeWithEvent.LocalEvent);
            var visitor = new DelegatingReflectionVisitor<int>
            {
                OnVisitEventInfoElement = e =>
                    e == sut ? expected : new DelegatingReflectionVisitor<int>()
            };

            // Exercise system
            var actual = sut.Accept(visitor);
            // Verify outcome
            Assert.Same(expected, actual);
            // Teardown
        }
Exemple #4
0
        public void AcceptCallsTheCorrectVisitorMethodAndReturnsTheCorrectInstance()
        {
            // Fixture setup
            var expected = new DelegatingReflectionVisitor <int>();
            var sut      = new EventInfoElement(TypeWithEvents.LocalEvent);
            var visitor  = new DelegatingReflectionVisitor <int>
            {
                OnVisitEventInfoElement = e =>
                                          e == sut ? expected : new DelegatingReflectionVisitor <int>()
            };

            // Exercise system
            var actual = sut.Accept(visitor);

            // Verify outcome
            Assert.Same(expected, actual);
            // Teardown
        }