Esempio n. 1
0
        public void GetFiltersOverridesControllerFiltersWithMethodFilters()
        {
            // DevDiv 222988
            // See comment in ReflectedActionDescriptor.RemoveOverriddenFilters()

            // Arrange
            Controller                controller = new OverriddenAttributeController();
            ControllerContext         context    = new Mock <ControllerContext>().Object;
            MethodInfo                methodInfo = typeof(OverriddenAttributeController).GetMethod("SomeMethod");
            ReflectedActionDescriptor ad         = GetActionDescriptor(methodInfo);

            // Act
            FilterInfo filters = ad.GetFilters();

            // Assert
            Assert.AreEqual(1, filters.ActionFilters.Count, "Wrong number of action filters.");
            Assert.AreEqual("Method", ((OutputCacheAttribute)filters.ActionFilters[0]).VaryByParam);
        }
        public void GetFiltersOverridesControllerFiltersWithMethodFilters() {
            // DevDiv 222988
            // See comment in ReflectedActionDescriptor.RemoveOverriddenFilters()

            // Arrange
            Controller controller = new OverriddenAttributeController();
            ControllerContext context = new Mock<ControllerContext>().Object;
            MethodInfo methodInfo = typeof(OverriddenAttributeController).GetMethod("BeginSomeMethod");
            ReflectedAsyncPatternActionDescriptor ad = GetActionDescriptor(methodInfo, null /* endMethod */);

            // Act
            FilterInfo filters = ad.GetFilters();

            // Assert
            Assert.AreEqual(1, filters.ActionFilters.Count, "Wrong number of action filters.");
            Assert.AreEqual("Method", ((OutputCacheAttribute)filters.ActionFilters[0]).VaryByParam);
        }