Exemplo n.º 1
0
        public void TryMoveAhead_NullPosition_ThrowArgumentNullException()
        {
            //Arrange
            ICardinalDirectionManager cardinalDirectionManager = new EastManager();

            //Act and Assert
            var exception = Assert.Throws <ArgumentNullException>(() => cardinalDirectionManager.TryMoveAhead(null));

            Assert.AreEqual("Value cannot be null. (Parameter 'position')", exception.Message);
        }
Exemplo n.º 2
0
        public void TryMoveAhead_FromEastestPosition_DontMove()
        {
            //Arrange
            var currentPosition = new Position(4, 0);
            ICardinalDirectionManager cardinalDirectionManager = new EastManager();

            //Act
            Position finalPosition = cardinalDirectionManager.TryMoveAhead(currentPosition);

            //Assert
            Assert.AreEqual(4, finalPosition.X);
            Assert.AreEqual(0, finalPosition.Y);
        }
Exemplo n.º 3
0
        public void TryMoveAhead_FromNotBorderPosition_IncreaseX()
        {
            //Arrange
            var currentPosition = new Position(1, 1);
            ICardinalDirectionManager cardinalDirectionManager = new EastManager();

            //Act
            Position finalPosition = cardinalDirectionManager.TryMoveAhead(currentPosition);

            //Assert
            Assert.AreEqual(2, finalPosition.X);
            Assert.AreEqual(1, finalPosition.Y);
        }