public void Update_When_gets_null_Then_return_exception() { //Arrange var service = new PilotService(_unit); //Act & Assert Assert.Throws <ArgumentNullException>(() => service.UpdatePilot(null)); }
public async Task UpdatePilot() { //assign pilot.Name = "Vladimir"; //act await pilotService.UpdatePilot(pilot.Id, pilot); PilotDTO checkPilot = await pilotService.GetPilot(pilot.Id); //assert Assert.That(checkPilot.Name == "Vladimir"); }
public void Update_When_gets_Valid_Then_Insert() { PilotDTO pilotDTO = new PilotDTO() { Id = 2, Name = "Quest", Surname = "Quest" }; //Arrange var service = new PilotService(_unit); //Act&Assert Assert.DoesNotThrow(() => service.UpdatePilot(pilotDTO)); }
public void Update_When_gets_notValidId_Then_return_exception() { //Arrange PilotDTO pilotDTO = new PilotDTO() { Id = 7, Name = "The ", Surname = "Most" }; var service = new PilotService(_unit); //Act & Assert Assert.Throws <ArgumentOutOfRangeException>(() => service.UpdatePilot(pilotDTO)); }
public void Update_When_gets_notValid_Then_return_exception() { //Arrange PilotDTO pilotDTO = new PilotDTO() { Id = 2, Name = "The ", Surname = "most amazing thing on the earth is a coffee without any milk and sugar.he most amazing thing on the earth is a coffee without any milk and sugar.he most amazing thing on the earth is a coffee without any milk and sugar. " }; var service = new PilotService(_unit); //Act & Assert Assert.Throws <AutoMapperMappingException>(() => service.UpdatePilot(pilotDTO)); }
public void PilotUpdate() { PilotService pilotService = new PilotService(unitOfWork); PilotDTO pilotDTO = new PilotDTO() { Name = "pilotCreateTest", Surname = "pilotCreateTest", Birth = new DateTime(1990, 1, 1), Experience = new TimeSpan(1, 2, 3) }; pilotService.UpdatePilot(1, pilotDTO); Pilot pilot = fakePilotRepo.Get(1); Assert.AreEqual(pilot.Name, pilotDTO.Name); Assert.AreEqual(pilot.Surname, pilotDTO.Surname); Assert.AreEqual(pilot.Birth, pilotDTO.Birth); Assert.AreEqual(pilot.Experience, pilotDTO.Experience); }