public void GetPilotById_WhenNegativeId_ThrowsArgumentException() { var id = -1; var service = new PilotService(fakeUnitOfWork, mapper); Assert.ThrowsAsync <ArgumentException>( () => service.GetById(id)); }
public void GetPilotById_WhenWrongId_ThrowsNotFoundException() { var id = 10; var service = new PilotService(fakeUnitOfWork, mapper); Assert.ThrowsAsync <NotFoundException>( () => service.GetById(id)); }
public async Task ReturnsDtoWithCorrectId() { var pilotService = new PilotService(_unitOfWork, _mapper); var pilot = await pilotService.GetById(5); Assert.AreEqual(5, pilot.Id); }
public async Task GetPilotById_WhenCorrectId_ReturnsPilot() { var id = 1; var service = new PilotService(fakeUnitOfWork, mapper); var result = await service.GetById(id); Assert.IsTrue(result != null); }
public async Task DeletePilot_WhenCorrectId_DeletesPilot() { var id = 1; var service = new PilotService(fakeUnitOfWork, mapper); await service.Remove(id); Assert.ThrowsAsync <NotFoundException>( () => service.GetById(id)); }