Exemple #1
0
        public void GetRules_ExpectRulesReturned()
        {
            var rule = new Rule {
                Index = 12, Word = "boom", RuleType = RuleType.MultipleOf
            };

            _repository.Stub(x => x.GetAll()).Return(new List <Rule> {
                rule
            });

            var result = _target.GetAll();

            Assert.IsNotNull(result);
            var response = result as OkNegotiatedContentResult <IList <Rule> >;

            Assert.IsNotNull(response);
            Assert.AreEqual(1, response.Content.Count());
            var retrievedRule = response.Content.First();

            Assert.AreEqual(rule.Index, retrievedRule.Index);
            Assert.AreEqual(rule.Word, retrievedRule.Word);
            Assert.AreEqual(rule.RuleType, retrievedRule.RuleType);
        }