public void ConstructorSetsProperties() {
            // Arrange
            string actionName = "SomeAction";
            ControllerDescriptor cd = new Mock<ControllerDescriptor>().Object;

            // Act
            ReflectedDelegatePatternActionDescriptor ad = new ReflectedDelegatePatternActionDescriptor(_actionMethod, actionName, cd);

            // Assert
            Assert.AreEqual(_actionMethod, ad.ActionMethod);
            Assert.AreEqual(actionName, ad.ActionName);
            Assert.AreEqual(cd, ad.ControllerDescriptor);
        }
        public void IsDefined() {
            // Arrange
            ReflectedDelegatePatternActionDescriptor ad = new ReflectedDelegatePatternActionDescriptor(_actionMethod, "SomeAction", new Mock<ControllerDescriptor>().Object);

            // Act
            bool isDefined = ad.IsDefined(typeof(AuthorizeAttribute), true /* inherit */);

            // Assert
            Assert.IsTrue(isDefined);
        }
        public void GetParametersWrapsParameterInfos() {
            // Arrange
            ParameterInfo pInfo = _actionMethod.GetParameters()[0];
            ReflectedDelegatePatternActionDescriptor ad = new ReflectedDelegatePatternActionDescriptor(_actionMethod, "SomeAction", new Mock<ControllerDescriptor>().Object);

            // Act
            ParameterDescriptor[] pDescsFirstCall = ad.GetParameters();
            ParameterDescriptor[] pDescsSecondCall = ad.GetParameters();

            // Assert
            Assert.AreNotSame(pDescsFirstCall, pDescsSecondCall, "GetParameters() should return a new array on each invocation.");
            Assert.IsTrue(pDescsFirstCall.SequenceEqual(pDescsSecondCall), "Array elements were not equal.");
            Assert.AreEqual(1, pDescsFirstCall.Length);

            ReflectedParameterDescriptor pDesc = pDescsFirstCall[0] as ReflectedParameterDescriptor;

            Assert.IsNotNull(pDesc, "Parameter 0 should have been of type ReflectedParameterDescriptor.");
            Assert.AreSame(ad, pDesc.ActionDescriptor, "Parameter 0 Action did not match.");
            Assert.AreSame(pInfo, pDesc.ParameterInfo, "Parameter 0 ParameterInfo did not match.");
        }