public void AddMarsRover_Should_Add_Mars_Rover_Plateau_When_Second_Expected_Value() { //Arrange var plateauService = new PlateauService(_loggerMock); plateauService.Create(6, 6); plateauService.AddMarsRover(new RoverPositionModel { Direction = Direction.East, X = 5, Y = 3 }); var roverPositionModel = new RoverPositionModel { Direction = Direction.East, X = 1, Y = 2 }; //Act plateauService.AddMarsRover(roverPositionModel); //Assert plateauService.GetMarsRovers().Count.Should().Be(2); plateauService.GetMarsRovers().Last().X.Should().Be(roverPositionModel.X); plateauService.GetMarsRovers().Last().Y.Should().Be(roverPositionModel.Y); plateauService.GetMarsRovers().Last().Direction.Should().Be(roverPositionModel.Direction); }
static void Main(string[] args) { bool validPlateauInfo = false; while (!validPlateauInfo) { Console.WriteLine("Lütfen platonun X ve Y koordinatlarını girin:"); var plateauInfo = Console.ReadLine(); validPlateauInfo = PlateauService.SetCoordinate(plateauInfo); } while (true) { bool validRoverPosition = false; Rover rover = new Rover(); while (!validRoverPosition) { Console.WriteLine("Lütfen gezginin konumunu girin:"); var roverPostionInfo = Console.ReadLine(); validRoverPosition = rover.SetPosition(roverPostionInfo); } Console.WriteLine("Lütfen gezgin için komut girin:"); var command = Console.ReadLine(); rover.RunCommand(command); Console.WriteLine(); var getPostion = rover.GetPostion(); Console.WriteLine("Gezginin mevcut konumu:"); Console.WriteLine(getPostion); Console.WriteLine(); } }
public void Create_Plateau_Test_Exception_With_Two_Character() { string coordinates = "e e"; IPlateauService plateauService = new PlateauService(); plateauService.CreatePlateau(coordinates); }
public void Create_Plateau_Test_Exception_Empty() { string coordinates = "5"; IPlateauService plateauService = new PlateauService(); plateauService.CreatePlateau(coordinates); }
public void CheckRover() { PlateauService.SetCoordinate("5 5"); Rover rover = new Rover(new Position(1, 2), Direction.North); rover.RunCommand("LMLMLMLMM"); var output = rover.GetPostion(); Assert.AreEqual(output, "1 3 N"); }
public void Create_Plateau_Test() { string coordinates = "5 5"; IPlateauService plateauService = new PlateauService(); plateauService.CreatePlateau(coordinates); Assert.AreEqual(plateauService.Plateau.UpperX, 5); Assert.AreEqual(plateauService.Plateau.UpperY, 5); }
public PlateauServiceTest() { //Given _loggerMock = new Mock <ILogger <PlateauService> >(); _plateauService = new PlateauService(_loggerMock.Object); _roverPositionModel = new RoverPositionModel { Direction = Direction.North, X = 1, Y = 1 }; }
public void Is_Valid_Coordinate_X_False_Test() { string coordinates = "5 5"; IPlateauService plateauService = new PlateauService(); plateauService.CreatePlateau(coordinates); var result = plateauService.IsValidPosition(new Models.Position { D = 'N', X = 6, Y = 2 }); Assert.AreEqual(false, result); }
public void Create_Should_Create_Plateau_When_Expected_Size() { //Arrange var plateauService = new PlateauService(_loggerMock); const int width = 5; const int height = 4; //Act plateauService.Create(width, height); //Assert plateauService.GetCurrentPlateau().Width.Should().Be(width); plateauService.GetCurrentPlateau().Height.Should().Be(height); }
public void Create_Should_Throw_InvalidSizeException_When_Negative_Size(int width, int height) { //Arrange var plateauService = new PlateauService(_loggerMock); //Act void Action() { plateauService.Create(width, height); } //Assert Assert.Throws <ValidatePlateauSizeException>((Action)Action); }
public void GivenPlateauServiceHasValidCommandThenParamsAreSet(string command) { //Arrange PlateauService sut = new PlateauService(command); var expectedWidth = Convert.ToInt32(command.Split(" ")[0]); var expectedHeight = Convert.ToInt32(command.Split(" ")[1]); //Act var response = sut.GetPlateau(); //Assert Assert.AreEqual(expectedWidth, response.Width); Assert.AreEqual(expectedHeight, response.Height); }
public PlateauTest() { _plateauService = new PlateauService(); }
public RoverTest() { _plateauService = new PlateauService(); _roverService = new RoverService(); }