Exemplo n.º 1
0
        public void GetCustomAttributesWithAttributeTypeCallsMethodInfoGetCustomAttributes()
        {
            // Arrange
            object[]          expected   = new object[0];
            Mock <MethodInfo> mockMethod = new Mock <MethodInfo>();

            mockMethod.Setup(mi => mi.GetCustomAttributes(typeof(ObsoleteAttribute), true)).Returns(expected);
            ReflectedActionDescriptor ad = GetActionDescriptor(mockMethod.Object);

            // Act
            object[] returned = ad.GetCustomAttributes(typeof(ObsoleteAttribute), true);

            // Assert
            Assert.Same(expected, returned);
        }
Exemplo n.º 2
0
        public void GetCustomAttributesCallsMethodInfoGetCustomAttributes()
        {
            // Arrange
            object[]          expected   = new object[0];
            Mock <MethodInfo> mockMethod = new Mock <MethodInfo>();

            mockMethod.Expect(mi => mi.GetCustomAttributes(true)).Returns(expected);
            ReflectedActionDescriptor ad = GetActionDescriptor(mockMethod.Object);

            // Act
            object[] returned = ad.GetCustomAttributes(true);

            // Assert
            Assert.AreSame(expected, returned);
        }