コード例 #1
0
        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());
        }
コード例 #2
0
        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());
        }
コード例 #3
0
        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));
        }