#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(); }
public Tests() { _explorationFactoryMock = Mock.Of <IExplorationFactory>(); _loggerRoverMock = Mock.Of <ILogger <RoverService> >(); _loggerPlateauMock = Mock.Of <ILogger <PlateauService> >(); _loggerInstructionMock = Mock.Of <ILogger <InstructionService> >(); _explorationCommandMock = Mock.Of <IExplorationCommand>(); }
public IExplorationCommand ExecuteInstruction(Instruction instruction) { IExplorationCommand explorationCommand = null; switch (instruction) { case Instruction.Right: explorationCommand = new RotateRightCommand(); break; case Instruction.Left: explorationCommand = new RotateLeftCommand(); break; case Instruction.Forward: explorationCommand = new MoveForwardCommand(); break; } return(explorationCommand); }