예제 #1
0
        public void PegsFactoryCreateUpAndRightFromBorderTest()
        {
            // Arrange
            var pegsFactory = new Peg.Factory(5, 9);
            var currentPeg  = pegsFactory.CreatePeg(5, 7);

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

            // Assert
            Assert.AreEqual(Peg.Create(4, 8), 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);
        }