Example #1
0
#pragma warning restore xUnit1010 // The value is not convertible to the method parameter type
        public void RotateLeftCommand_ValidPlateauValidRoverAndValidInstructions_ShouldBeEqualGivenResult(int width, int height, int xPosition, int yPosition, Directions direction, Directions result)
        {
            _plateauService = new PlateauService();
            _roverService   = new RoverService(_explorationFactoryMock);

            BaseModels <PlateauModel> basePlateauModel = _plateauService.Create(width, height);

            basePlateauModel.Data.Width.Should().Equals(width);
            basePlateauModel.Data.Height.Should().Equals(height);

            RoverLocationModel roverLocation = new RoverLocationModel()
            {
                Direction = direction,
                XPosition = xPosition,
                YPosition = yPosition
            };

            BaseModels <RoverModel> baseRoverModel = _roverService.Initalize(basePlateauModel.Data, roverLocation);

            _explorationCommandMock = new RotateLeftCommand();

            _explorationCommandMock.Explore(_roverService.GetCurrentRover().Data.Location);

            _roverService.GetCurrentRover().Data.Location.Direction.Should().Be(result);
            Console.WriteLine(result);
            Console.ReadLine();
        }
Example #2
0
        public void Execute()
        {
            var roverPosition = _roverService.GetCurrentRover();

            roverPosition.Direction = _directionService.Left(roverPosition.Direction);
            _roverService.ChangePosition(roverPosition);
        }