示例#1
0
        public void PegsFactoryCreateUpAndLeftFromTest()
        {
            // Arrange
            var pegsFactory = new Peg.Factory(5, 9);
            var currentPeg  = pegsFactory.CreatePeg(5, 1);

            // Act
            var actual  = pegsFactory.CreateUpAndLeftFrom(currentPeg);
            var actual2 = pegsFactory.CreateUpAndLeftFrom(actual);

            // Assert
            Assert.AreEqual(Peg.Create(4, 0), actual);
            Assert.AreEqual(Peg.OutOfBoard, actual2);
        }
示例#2
0
        public void PegsFactoryCreateUpAndRightFromTest()
        {
            // Arrange
            var pegsFactory = new Peg.Factory(5, 9, new []
            {
                Peg.CreateMissingPeg(2, 1)
            });
            var currentPeg = pegsFactory.CreatePeg(5, 1);

            // Act
            var actual  = pegsFactory.CreateUpAndRigthFrom(currentPeg);
            var actual2 = pegsFactory.CreateUpAndRigthFrom(actual);
            var actual3 = pegsFactory.CreateUpAndLeftFrom(actual2);

            // Assert
            Assert.AreEqual(Peg.Create(4, 2), actual);
            Assert.AreEqual(Peg.Create(3, 3), actual2);
            Assert.IsTrue(actual3.IsMissingPeg);
        }