Esempio n. 1
0
 public void AcceptNullVisitorThrows()
 {
     // Fixture setup
     var sut = new TypeElement(this.GetType());
     // 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 TypeElement(this.GetType());

            // Exercise system
            // Verify outcome
            Assert.Throws <ArgumentNullException>(() =>
                                                  sut.Accept((IReflectionVisitor <object>)null));
            // Teardown
        }
Esempio n. 3
0
        public void AcceptCallsTheCorrectVisitorMethodAndReturnsTheCorrectInstance()
        {
            // Fixture setup
            var expected = new DelegatingReflectionVisitor<int>();
            var sut = new TypeElement(this.GetType());
            var visitor = new DelegatingReflectionVisitor<int>
            {
                OnVisitTypeElement = 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 TypeElement(this.GetType());
            var visitor  = new DelegatingReflectionVisitor <int>
            {
                OnVisitTypeElement = e =>
                                     e == sut ? expected : new DelegatingReflectionVisitor <int>()
            };

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

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