public void AcceptNullVisitorThrows()
 {
     // Fixture setup
     var sut = new MethodInfoElement(TypeWithMethods.Method);
     // Exercise system
     // Verify outcome
     Assert.Throws<ArgumentNullException>(() =>
         sut.Accept((IReflectionVisitor<object>)null));
     // Teardown
 }
Esempio n. 2
0
        public void AcceptNullVisitorThrows()
        {
            // Fixture setup
            var sut = new MethodInfoElement(TypeWithMethods.Method);

            // 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 MethodInfoElement(TypeWithMethods.Method);
            var visitor = new DelegatingReflectionVisitor<int>
            {
                OnVisitMethodInfoElement = e =>
                    e == sut ? expected : new DelegatingReflectionVisitor<int>()
            };

            // Exercise system
            var actual = sut.Accept(visitor);
            // Verify outcome
            Assert.Same(expected, actual);
            // Teardown
        }
Esempio n. 4
0
        public void AcceptCallsTheCorrectVisitorMethodAndReturnsTheCorrectInstance()
        {
            // Fixture setup
            var expected = new DelegatingReflectionVisitor <int>();
            var sut      = new MethodInfoElement(TypeWithMethods.Method);
            var visitor  = new DelegatingReflectionVisitor <int>
            {
                OnVisitMethodInfoElement = e =>
                                           e == sut ? expected : new DelegatingReflectionVisitor <int>()
            };

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

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