コード例 #1
0
ファイル: CommandTests.cs プロジェクト: hkshambesh/PlutoRover
        public void When_command_is_forward_and_direction_west_decrease_by_one_test()
        {
            // act
            var commandR = new CommandF();
            var rover = new Rover
            {
                Command = Command.F,
                Position = new Position
                {
                    Direction = Direction.W,
                    X = 0,
                    Y = 0
                }
            };

            // actual
            rover.Position = commandR.ExecuteCommand(rover);

            // assert
            Assert.AreEqual(-1, rover.Position.X);
        }
コード例 #2
0
ファイル: CommandTests.cs プロジェクト: hkshambesh/PlutoRover
        public void When_command_is_forward_and_direction_north_increase_by_one_test()
        {
            // act
            var commandR = new CommandF();
            var rover = new Rover
            {
                Command = Command.F,
                Position = new Position
                {
                    Direction = Direction.N,
                    X = 0,
                    Y = 0
                }
            };

            // actual and Assert
            rover.Position = commandR.ExecuteCommand(rover);
            Assert.AreEqual(1, rover.Position.Y);

            rover.Position = commandR.ExecuteCommand(rover);
            Assert.AreEqual(2, rover.Position.Y);
        }