public void AcceptNullVisitorThrows() { // Fixture setup var sut = new TypeElement(this.GetType()); // Exercise system // Verify outcome Assert.Throws<ArgumentNullException>(() => sut.Accept((IReflectionVisitor<object>)null)); // Teardown }
public void AcceptNullVisitorThrows() { // Fixture setup var sut = new TypeElement(this.GetType()); // 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 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 }
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 }