public void InvalidRulesParamsMatchesNoRules() { _controller = ConfigureControllerContext("http://localhost/api/flights?rules=notexpectingthis", new FlightsController(_rulesService, _builder)); var rules = _controller.GetRulesToApply(); A.CallTo(() => _rulesService.GetRules()).MustHaveHappened(); Assert.AreEqual(0, rules.Count()); }
public void NoRulesParamAppliesAllRules() { _controller = ConfigureControllerContext("http://localhost/api/flights", new FlightsController(_rulesService, _builder)); var rules = _controller.GetRulesToApply(); A.CallTo(() => _rulesService.GetRules()).MustHaveHappened(); Assert.AreEqual(3, rules.Count()); }
public void ValidRulesParamsParsedCorrectly() { _controller = ConfigureControllerContext("http://localhost/api/flights?rules=2,1", new FlightsController(_rulesService, _builder)); var rules = _controller.GetRulesToApply(); A.CallTo(() => _rulesService.GetRules()).MustHaveHappened(); Assert.AreEqual(2, rules.Count()); Assert.IsTrue(rules.Any(r => r.Id == 1)); Assert.IsTrue(rules.Any(r => r.Id == 2)); }