コード例 #1
0
        public void MoveCommandRun_ShouldIgnoreIfRobotPositionIsNull()
        {
            // Arrange
            Robot testRobot = new Robot();
            MoveCommand moveCommand = new MoveCommand();

            // Act
            bool success = moveCommand.Run(testRobot);

            // Assert
            Assert.IsFalse(success);
        }
コード例 #2
0
        public void MoveCommandRun_ShouldMoveIfPositionExisits()
        {
            // Arrange
            Robot testRobot = new Robot();
            testRobot.Position = new Position(0, 0, Direction.North);
            MoveCommand moveCommand = new MoveCommand();

            // Act
            bool success = moveCommand.Run(testRobot);

            // Assert
            Assert.IsTrue(success);
        }
コード例 #3
0
        public void MoveCommandRun_ShouldMoveOneUnitInFacingDirection()
        {
            // Arrange
            Robot testRobot = new Robot();
            testRobot.Position = new Position(0, 0, Direction.North);
            MoveCommand moveCommand = new MoveCommand();
            Position expectedPosition = new Position(0,1,Direction.North);

            // Act
            bool success = moveCommand.Run(testRobot);

            // Assert
            Assert.IsTrue(expectedPosition.Equals(testRobot.Position));
        }