public void AcceptNullVisitorThrows()
 {
     // Fixture setup
     var sut = new PropertyInfoElement(TypeWithProperty.Property);
     // Exercise system
     // Verify outcome
     Assert.Throws<ArgumentNullException>(() =>
         sut.Accept((IReflectionVisitor<object>)null));
     // Teardown
 }
Ejemplo n.º 2
0
        public void AcceptNullVisitorThrows()
        {
            // Fixture setup
            var sut = new PropertyInfoElement(TypeWithProperties.Property);

            // 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 PropertyInfoElement(TypeWithProperty.Property);
            var visitor = new DelegatingReflectionVisitor<int>
            {
                OnVisitPropertyInfoElement = e =>
                    e == sut ? expected : new DelegatingReflectionVisitor<int>()
            };

            // Exercise system
            var actual = sut.Accept(visitor);
            // Verify outcome
            Assert.Same(expected, actual);
            // Teardown
        }
Ejemplo n.º 4
0
        public void AcceptCallsTheCorrectVisitorMethodAndReturnsTheCorrectInstance()
        {
            // Fixture setup
            var expected = new DelegatingReflectionVisitor <int>();
            var sut      = new PropertyInfoElement(TypeWithProperties.Property);
            var visitor  = new DelegatingReflectionVisitor <int>
            {
                OnVisitPropertyInfoElement = e =>
                                             e == sut ? expected : new DelegatingReflectionVisitor <int>()
            };

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

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