public ActionResult <FeatureModel> Active() { var parameters = ControllerContext.HttpContext.Request.Query.ToDictionary(s => s.Key, s => s.Value.ToString()); if (!parameters.ContainsKey("key")) { return(NotFound()); } var key = parameters["key"]; bool activated = false; if (parameters.Count > 1) { var jsonPath = PathBuilder.Parse(parameters.Where(i => i.Key != "key")); activated = manager.Active(key, jsonPath); } else { activated = manager.Active(key); } return(new JsonResult(new FeatureModel { Name = key, Activated = activated })); }
public void Test_Manager_Should_Return_Inactive_If_Switch_Does_Not_Exist() { var feature = manager.Active("feature:switch:invalid"); Assert.IsFalse(feature); }