public void SutDoesNotEqualAnonymousObject(object other)
        {
            var sut    = new LocalVariableInfoElement(TypeWithLocalVariables.LocalVariable);
            var actual = sut.Equals(other);

            Assert.False(actual);
        }
        public void ToElementForLocalVariableInfoReturnsTheCorrectElement()
        {
            LocalVariableInfo        expected = TypeWithAllElements.LocalVariableInfo;
            LocalVariableInfoElement actual   = expected.ToElement();

            Assert.Equal(new LocalVariableInfoElement(expected), actual);
        }
 public void SutIsReflectionElement()
 {
     // Fixture setup
     // Exercise system
     var sut = new LocalVariableInfoElement(TypeWithLocalVariables.LocalVariable);
     // Verify outcome
     Assert.IsAssignableFrom<IReflectionElement>(sut);
     // Teardown
 }
        public void GetHashCodeReturnsCorrectResult()
        {
            var lvi = TypeWithLocalVariable.LocalVariable;
            var sut = new LocalVariableInfoElement(lvi);

            var actual = sut.GetHashCode();

            var expected = lvi.GetHashCode();
            Assert.Equal(expected, actual);
        }
        public void SutEqualsOtherIdenticalInstance()
        {
            var lvi = TypeWithLocalVariables.LocalVariable;
            var sut = new LocalVariableInfoElement(lvi);
            var other = new LocalVariableInfoElement(lvi);

            var actual = sut.Equals(other);

            Assert.True(actual);
        }
 public void AcceptNullVisitorThrows()
 {
     // Fixture setup
     var sut = new LocalVariableInfoElement(TypeWithLocalVariable.LocalVariable);
     // Exercise system
     // Verify outcome
     Assert.Throws<ArgumentNullException>(() =>
         sut.Accept((IReflectionVisitor<object>)null));
     // Teardown
 }
        public void SutEqualsOtherIdenticalInstance()
        {
            var lvi   = TypeWithLocalVariables.LocalVariable;
            var sut   = new LocalVariableInfoElement(lvi);
            var other = new LocalVariableInfoElement(lvi);

            var actual = sut.Equals(other);

            Assert.True(actual);
        }
        public void SutDoesNotEqualDifferentInstanceOfSameType()
        {
            var sut = new LocalVariableInfoElement(TypeWithLocalVariables.LocalVariable);
            var otherLocalVariable = TypeWithLocalVariables.OtherLocalVariable;
            var other = new LocalVariableInfoElement(otherLocalVariable);

            var actual = sut.Equals(other);

            Assert.False(actual);
        }
        public void SutIsReflectionElement()
        {
            // Fixture setup
            // Exercise system
            var sut = new LocalVariableInfoElement(TypeWithLocalVariables.LocalVariable);

            // Verify outcome
            Assert.IsAssignableFrom <IReflectionElement>(sut);
            // Teardown
        }
 public void LocalVariableInfoIsCorrect()
 {
     // Fixture setup
     var expected = TypeWithLocalVariable.LocalVariable;
     var sut = new LocalVariableInfoElement(expected);
     // Exercise system
     LocalVariableInfo actual = sut.LocalVariableInfo;
     // Verify outcome
     Assert.Equal(expected, actual);
     // Teardown
 }
        public void AcceptNullVisitorThrows()
        {
            // Fixture setup
            var sut = new LocalVariableInfoElement(TypeWithLocalVariables.LocalVariable);

            // Exercise system
            // Verify outcome
            Assert.Throws <ArgumentNullException>(() =>
                                                  sut.Accept((IReflectionVisitor <object>)null));
            // Teardown
        }
        public void GetHashCodeReturnsCorrectResult()
        {
            var lvi = TypeWithLocalVariables.LocalVariable;
            var sut = new LocalVariableInfoElement(lvi);

            var actual = sut.GetHashCode();

            var expected = lvi.GetHashCode();

            Assert.Equal(expected, actual);
        }
예제 #13
0
        public void VisitLocalVariableInfoElementReturnsCorrectResult()
        {
            var sut = new ReflectionVisitor();
            var localVariableInfoElement =
                new LocalVariableInfoElement(new Dummy().LocalVariable);

            var actual = sut.Visit(localVariableInfoElement);

            var expected = sut;

            Assert.Same(expected, actual);
        }
        public void LocalVariableInfoIsCorrect()
        {
            // Fixture setup
            var expected = TypeWithLocalVariables.LocalVariable;
            var sut      = new LocalVariableInfoElement(expected);
            // Exercise system
            LocalVariableInfo actual = sut.LocalVariableInfo;

            // Verify outcome
            Assert.Equal(expected, actual);
            // Teardown
        }
        public void AcceptCallsTheCorrectVisitorMethodAndReturnsTheCorrectInstance()
        {
            // Fixture setup
            var expected = new DelegatingReflectionVisitor<int>();
            var sut = new LocalVariableInfoElement(TypeWithLocalVariable.LocalVariable);
            var visitor = new DelegatingReflectionVisitor<int>
            {
                OnVisitLocalVariableInfoElement = 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 LocalVariableInfoElement(TypeWithLocalVariables.LocalVariable);
            var visitor  = new DelegatingReflectionVisitor <int>
            {
                OnVisitLocalVariableInfoElement = e =>
                                                  e == sut ? expected : new DelegatingReflectionVisitor <int>()
            };

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

            // Verify outcome
            Assert.Same(expected, actual);
            // Teardown
        }
예제 #17
0
 public virtual IReflectionVisitor <T> Visit(LocalVariableInfoElement localVariableInfoElement)
 {
     return(OnVisitLocalVariableInfoElement(localVariableInfoElement));
 }
        public void SutDoesNotEqualDifferentInstanceOfSameType()
        {
            var sut = new LocalVariableInfoElement(TypeWithLocalVariable.LocalVariable);
            var otherLocalVariable = TypeWithLocalVariable.OtherLocalVariable;
            var other = new LocalVariableInfoElement(otherLocalVariable);

            var actual = sut.Equals(other);

            Assert.False(actual);
        }
 public void SutDoesNotEqualAnonymousObject(object other)
 {
     var sut = new LocalVariableInfoElement(TypeWithLocalVariable.LocalVariable);
     var actual = sut.Equals(other);
     Assert.False(actual);
 }