public async Task DeletePilot_when_delete_pilot_then_get_null() { var pilots = await _airportService.GetAll <Pilot>(); var newPilot = pilots.Last(); Assert.False(newPilot == null); await _airportService.Delete <Pilot>(newPilot.Id); await _airportService.SaveChanges(); var deletedPilot = await _airportService.GetById <Pilot>(newPilot.Id); Assert.True(deletedPilot == null); await _airportService.Post(new Pilot() { Name = newPilot.Name, Surname = newPilot.Surname, Experience = newPilot.Experience }); await _airportService.SaveChanges(); }
public void ReturnNull_WhenIdIsNull() { // Arrange var wrapperMock = new Mock <IEfDbSetWrapper <Airport> >(); var dbContextMock = new Mock <IAirTicketDbContextSaveChanges>(); var airportService = new AirportService(wrapperMock.Object, dbContextMock.Object); // Act var airportModel = airportService.GetById(null); // Assert Assert.IsNull(airportModel); }
public void ReturnNull_WhenThereIsNoModelWithThePassedId() { // Arrange var wrapperMock = new Mock <IEfDbSetWrapper <Airport> >(); var dbContextMock = new Mock <IAirTicketDbContextSaveChanges>(); Guid?airportId = Guid.NewGuid(); wrapperMock.Setup(m => m.GetById(airportId.Value)).Returns((Airport)null); var airportService = new AirportService(wrapperMock.Object, dbContextMock.Object); // Act var airportModel = airportService.GetById(airportId); // Assert Assert.IsNull(airportModel); }
public void GetByIdTestFixture() { //Create a mock object of a Flight class var mockAirport = new Mock <IAirport>(); //Configure dummy method so that it return true when it gets any string as parameters to the method mockAirport.Setup(r => r.GetById(0)).Returns(new Airport()); IAirport airportServices = new AirportService(_unitOfWork); var result = airportServices.GetById(0); //Verify the result is what is expected Assert.IsTrue(result != null); //Verify that our mock has been called mockAirport.Verify(m => m.GetById(0)); }
public TicketDTO Get(int id) { return(Mapper.Map <Ticket, TicketDTO>(_service.GetById <Ticket>(id))); }
public async Task <PlaneTypeDTO> Get(int id) { return(Mapper.Map <PlaneType, PlaneTypeDTO>(await _service.GetById <PlaneType>(id))); }
public CrewDTO Get(int id) { return(Mapper.Map <Crew, CrewDTO>(_service.GetById <Crew>(id))); }
public PlaneDTO Get(int id) { return(Mapper.Map <Plane, PlaneDTO>(_service.GetById <Plane>(id))); }
public StewardessDTO Get(int id) { return(Mapper.Map <Stewardess, StewardessDTO>(_service.GetById <Stewardess>(id))); }
public async Task <CrewDTO> Get(int id) { return(_mapper.Map <Crew, CrewDTO>(await _service.GetById <Crew>(id))); }
public FlightDTO Get(int number) { return(Mapper.Map <Flight, FlightDTO>(_service.GetById <Flight>(number))); }
public async Task <DepartureDTO> Get(int id) { return(Mapper.Map <Departure, DepartureDTO>(await _service.GetById <Departure>(id))); }
public async Task <FlightDTO> Get(int number) { return(_mapper.Map <Flight, FlightDTO>(await _service.GetById <Flight>(number))); }
public async Task <StewardessDTO> Get(int id) { return(Mapper.Map <Stewardess, StewardessDTO>(await _service.GetById <Stewardess>(id))); }
public async Task <PilotDTO> Get(int id) { return(Mapper.Map <Pilot, PilotDTO>(await _service.GetById <Pilot>(id))); }
public async Task <Airport> GetAirportAsync(int id, CancellationToken ct) { return(await _airportServices.GetById(id, ct));; }
public async Task <TicketDTO> Get(int id) { return(_mapper.Map <Ticket, TicketDTO>(await _service.GetById <Ticket>(id))); }
public DepartureDTO Get(int id) { return(Mapper.Map <Departure, DepartureDTO>(_service.GetById <Departure>(id))); }
public PilotDTO Get(int id) { return(Mapper.Map <Pilot, PilotDTO>(_service.GetById <Pilot>(id))); }