public void MatchDoesNotMatchWithNoDataFormat() { DataFormatCriteria criteria = new DataFormatCriteria("RSS"); RouteData routeData = new RouteData(); ActionFilterRegistryContext context = new ActionFilterRegistryContext(new System.Web.Mvc.ControllerContext(new FakeHttpContext("~/"), routeData, new FakeController()), new FakeActionDescriptor()); Assert.False(criteria.Match(context)); }
public void MatchMatchesPassedDataFormat() { DataFormatCriteria criteria = new DataFormatCriteria("RSS"); RouteData routeData = new RouteData(); routeData.Values.Add("dataFormat", "RSS"); ActionFilterRegistryContext context = new ActionFilterRegistryContext(new System.Web.Mvc.ControllerContext(new FakeHttpContext("~/"), routeData, new FakeController()), new FakeActionDescriptor()); Assert.True(criteria.Match(context)); }
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)); }
public bool Match(ActionFilterRegistryContext context) { return(IsMatch); }
public bool Match(ActionFilterRegistryContext context) { return(string.Equals(format, context.ControllerContext.RouteData.Values["dataFormat"] as string, StringComparison.OrdinalIgnoreCase)); }