Пример #1
0
        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();
        }
Пример #2
0
        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);
        }
Пример #3
0
        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));
        }
Пример #5
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)));
 }
Пример #7
0
 public CrewDTO Get(int id)
 {
     return(Mapper.Map <Crew, CrewDTO>(_service.GetById <Crew>(id)));
 }
Пример #8
0
 public PlaneDTO Get(int id)
 {
     return(Mapper.Map <Plane, PlaneDTO>(_service.GetById <Plane>(id)));
 }
Пример #9
0
 public StewardessDTO Get(int id)
 {
     return(Mapper.Map <Stewardess, StewardessDTO>(_service.GetById <Stewardess>(id)));
 }
Пример #10
0
 public async Task <CrewDTO> Get(int id)
 {
     return(_mapper.Map <Crew, CrewDTO>(await _service.GetById <Crew>(id)));
 }
Пример #11
0
 public FlightDTO Get(int number)
 {
     return(Mapper.Map <Flight, FlightDTO>(_service.GetById <Flight>(number)));
 }
Пример #12
0
 public async Task <DepartureDTO> Get(int id)
 {
     return(Mapper.Map <Departure, DepartureDTO>(await _service.GetById <Departure>(id)));
 }
Пример #13
0
 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)));
 }
Пример #15
0
 public async Task <PilotDTO> Get(int id)
 {
     return(Mapper.Map <Pilot, PilotDTO>(await _service.GetById <Pilot>(id)));
 }
Пример #16
0
 public async Task <Airport> GetAirportAsync(int id, CancellationToken ct)
 {
     return(await _airportServices.GetById(id, ct));;
 }
Пример #17
0
 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)));
 }
Пример #19
0
 public PilotDTO Get(int id)
 {
     return(Mapper.Map <Pilot, PilotDTO>(_service.GetById <Pilot>(id)));
 }