public void MatchMatchesMultipleMethods() { ControllerActionCriteria criteria = new ControllerActionCriteria(); criteria.AddMethod <FakeController>(c => c.Action()); criteria.AddMethod <FakeController>(c => c.ActionWithParameters(null)); MethodInfo actionMethod = typeof(FakeController).GetMethod("Action"); MethodInfo actionMethodWithParameters = typeof(FakeController).GetMethod("ActionWithParameters"); Assert.True(criteria.Match(this.GetContext(actionMethod))); Assert.True(criteria.Match(this.GetContext(actionMethodWithParameters))); }
public void MatchMatchesMethod() { ControllerActionCriteria criteria = new ControllerActionCriteria(); criteria.AddMethod <FakeController>(c => c.Action()); MethodInfo actionMethod = typeof(FakeController).GetMethod("Action"); Assert.True(criteria.Match(this.GetContext(actionMethod))); }
public void MatchWorksOnNonReflectedActionDescriptor() { ControllerActionCriteria criteria = new ControllerActionCriteria(); criteria.AddMethod <FakeController>(c => c.RealNameIsAliasedAction()); MethodInfo actionMethod = typeof(FakeController).GetMethod("RealNameIsAliasedAction"); ActionFilterRegistryContext context = new ActionFilterRegistryContext(new ControllerContext(), new FakeActionDescriptor() { Name = "AliasedAction" }); Assert.True(criteria.Match(context)); }