示例#1
0
        public void ShouldPerformNestAction()
        {
            var owls = new Parliament(2);

            owls.Nest(0);

            owls.AssertPositionsMatch(1);
            Assert.AreEqual(1, owls.InTheNest);
        }
示例#2
0
        public void ShouldThrowWhenReferencingNonowl()
        {
            var owls = new Parliament(2);

            Assert.ThrowsException <InvalidMoveException>(() => {
                owls.Move(2, 10);
            });
            Assert.ThrowsException <InvalidMoveException>(() => {
                owls.Nest(2);
            });
        }
示例#3
0
        public void ShouldNotBeEqualIfTheyHaveDifferentOwlCounts()
        {
            var twoOwls   = new Parliament(2);
            var threeOwls = new Parliament(3);

            threeOwls.Nest(threeOwls.LeadOwl);

            twoOwls.AssertPositionsMatch(threeOwls);
            Assert.AreEqual(0, twoOwls.InTheNest);
            Assert.AreEqual(1, threeOwls.InTheNest);
            Assert.AreNotEqual(twoOwls, threeOwls);
        }
示例#4
0
        public void ShouldBeEqualIfTheyRepresentTheSameState()
        {
            var someOwls      = new Parliament(2);
            var identicalOwls = new Parliament(2);

            someOwls.Nest(someOwls.TrailingOwl);
            someOwls.Move(someOwls.LeadOwl, 20);

            // The same actions in the other order should be equivalent.
            identicalOwls.Move(identicalOwls.LeadOwl, 20);
            identicalOwls.Nest(identicalOwls.TrailingOwl);

            Assert.AreEqual(someOwls, identicalOwls);
        }