示例#1
0
        public void Run_ShouldHandleMultipleActions()
        {
            var action = new RotateAction(_robot, _mapProvider, RotateDirection.Right);

            action.Run();
            action.Run();
            Assert.Equal(Direction.North, _robot.Direction);
        }
示例#2
0
        public void Run_ShouldRotateToSameDirection()
        {
            var action = new RotateAction(_robot, _mapProvider, RotateDirection.Right);

            action.Run();
            action.Run();
            action.Run();
            action.Run();
            Assert.Equal(Direction.South, _robot.Direction);
        }
示例#3
0
        public void Run_ShouldNotThrowException__IfRobotNotPlaced()
        {
            _robot.Position = null;
            var action = new RotateAction(_robot, _mapProvider, RotateDirection.Left);

            action.Run();
        }
示例#4
0
        public void Run_ShouldNotChangePosition()
        {
            var action = new RotateAction(_robot, _mapProvider, RotateDirection.Left);

            action.Run();
            Assert.Equal(3, _robot.Position.Latitude);
            Assert.Equal(2, _robot.Position.Longitude);
        }
示例#5
0
        public void Run_ShouldUpdateDirection_WhenRotateLeft(Direction robotDirection, Direction expectedDirection)
        {
            _robot.Direction = robotDirection;
            var action = new RotateAction(_robot, _mapProvider, RotateDirection.Left);

            action.Run();
            Assert.Equal(expectedDirection, _robot.Direction);
        }