Ejemplo n.º 1
0
        public void ShouldPerformMoveAction()
        {
            var owls = new Parliament(2);

            owls.Move(0, 2);

            owls.AssertPositionsMatch(1, 2);
            Assert.AreEqual(0, owls.InTheNest);
        }
Ejemplo n.º 2
0
        public void ShouldThrowWhenReferencingNonowl()
        {
            var owls = new Parliament(2);

            Assert.ThrowsException <InvalidMoveException>(() => {
                owls.Move(2, 10);
            });
            Assert.ThrowsException <InvalidMoveException>(() => {
                owls.Nest(2);
            });
        }
Ejemplo n.º 3
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);
        }