示例#1
0
        public void CheckAddCageTest()
        {
            var rootCage = new Cage();
            var animal   = new Wolf("test", 1);

            var result = new CheckAddCageCageSelector().SelectCage(rootCage, animal);

            Assert.AreEqual(1, rootCage.Children.Count);
            Assert.AreEqual(result, rootCage.Children[0]);
        }
示例#2
0
        public void CheckAddCageTooManyCagesTest()
        {
            var rootCage = new Cage();

            for (int i = 0; i < 3; ++i)
            {
                rootCage.Children.Add(new Cage());
            }
            var animal = new Wolf("test", 1);

            var mockSelector = GetCageSelectorMock();

            var cageSelector = new CheckAddCageCageSelector();

            cageSelector.Successor = mockSelector.Object;

            var result = cageSelector.SelectCage(rootCage, animal);

            mockSelector.Verify(c => c.SelectCage(rootCage, animal));
            Assert.AreEqual(3, rootCage.Children.Count);
        }