Example #1
0
        public BookingServiceTests()
        {
            MapperConfiguration mappingConfig = new MapperConfiguration(config =>
            {
                config.CreateMap <Flight, FlightEntity>();
                config.CreateMap <FlightEntity, Flight>();
                config.CreateMap <FlightSeatTypeCost, FlightSeatTypeCostEntity>();
                config.CreateMap <FlightSeatTypeCostEntity, FlightSeatTypeCost>();
                config.CreateMap <FlightFilter, FlightFilterEntity>();
                config.CreateMap <FlightFilterEntity, FlightFilter>();
                config.CreateMap <FlightBookInfo, FlightBookInfoEntity>();
                config.CreateMap <FlightBookInfoEntity, FlightBookInfo>();
                config.CreateMap <SeatBook, SeatBookEntity>();
                config.CreateMap <SeatBookEntity, SeatBook>();
            });

            mappingConfig.CompileMappings();

            IMapper mapper = mappingConfig.CreateMapper();

            IBookingSettings bookingSettings = new BookingSettingsMock(new TimeSpan(0, 5, 0));

            _bookingService = new BookingService(
                mapper,
                new FlightRepositoryMock(bookingSettings),
                new AirplanesRepositoryMock(),
                new UserInfoMock(1)
                );
        }
        public FlightServiceTests()
        {
            MapperConfiguration mappingConfig = new MapperConfiguration(config =>
            {
                config.CreateMap <Flight, FlightEntity>();
                config.CreateMap <FlightEntity, Flight>();
                config.CreateMap <FlightSeatTypeCost, FlightSeatTypeCostEntity>();
                config.CreateMap <FlightSeatTypeCostEntity, FlightSeatTypeCost>();
                config.CreateMap <FlightFilter, FlightFilterEntity>();
                config.CreateMap <FlightFilterEntity, FlightFilter>();
                config.CreateMap <FlightBookInfo, FlightBookInfoEntity>();
                config.CreateMap <FlightBookInfoEntity, FlightBookInfo>();
            });

            mappingConfig.CompileMappings();

            IMapper mapper = mappingConfig.CreateMapper();

            IBookingSettings bookingSettings = new BookingSettingsMock(TimeSpan.FromMinutes(5));

            _flightService = new FlightService(
                mapper,
                new FlightRepositoryMock(bookingSettings),
                new AirportRepositoryMock(),
                new AirplanesRepositoryMock()
                );
        }