Example #1
0
        public void PegsFactoryCreateOutOfBoardTest()
        {
            // Arrange
            var pegsFactory = new Peg.Factory(5, 9);

            // Act
            var actual = pegsFactory.CreatePeg(-1, 1);

            // Assert
            Assert.AreEqual(Peg.OutOfBoard, actual);
        }
Example #2
0
        public void PegsFactoryCreateTest()
        {
            // Arrange
            var pegsFactory = new Peg.Factory(5, 9);

            // Act
            var actual = pegsFactory.CreatePeg(5, 1);

            // Assert
            Assert.AreEqual(Peg.Create(5, 1), actual);
        }
Example #3
0
        public void PegsFactoryCreatePegUpFromTest()
        {
            // Arrange
            var pegsFactory = new Peg.Factory(5, 9);
            var currentPeg  = pegsFactory.CreatePeg(5, 1);

            // Act
            var actual = pegsFactory.CreatePegUpFrom(currentPeg);

            // Assert
            Assert.AreEqual(Peg.Create(3, 1), actual);
        }
Example #4
0
        public void PegsFactoryCreateUpAndLeftFromBorderTest()
        {
            // Arrange
            var pegsFactory = new Peg.Factory(5, 9);
            var currentPeg  = pegsFactory.CreatePeg(2, 0);

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

            // Assert
            Assert.AreEqual(Peg.OutOfBoard, actual);
        }
Example #5
0
        public void PegsFactoryCreateOnMissingPegTest()
        {
            // Arrange
            var pegsFactory = new Peg.Factory(5, 9, new []
            {
                Peg.CreateMissingPeg(2, 1)
            });

            // Act
            var actual = pegsFactory.CreatePeg(2, 2);

            // Assert
            Assert.IsTrue(actual.IsMissingPeg);
        }
Example #6
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);
        }
Example #7
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);
        }