コード例 #1
0
        public DefaultFlightServiceTests()
        {
            // Configure an instance of the FlightsDBContext and 'in memory' database.
            // NOTE : Ensure that the name passed to UseInMemoryDatabase is unique to this test class!
            var optionsBuilder = new DbContextOptionsBuilder <FlightsDBContext>();

            optionsBuilder.UseInMemoryDatabase("DefaultFlightServiceTests");
            _context = new FlightsDBContext(optionsBuilder.Options);

            // Call the helper class to initialise AutoMapper since it handles multithreading.
            AutoMapperHelper.Initialize();
        }
コード例 #2
0
        public DefaultAvailabilityServiceTests()
        {
            // Configure an instance of the FlightsDBContext and 'in memory' database.
            // NOTE : Ensure that the name passed to UseInMemoryDatabase is unique to this test class!
            var optionsBuilder = new DbContextOptionsBuilder <FlightsDBContext>();

            optionsBuilder.UseInMemoryDatabase("DefaultAvailabilityServiceTests");
            _context = new FlightsDBContext(optionsBuilder.Options);

            // Create test data before any calls
            var flights = FlightEntity.GenerateTestData();

            _context.Flights.AddRange(flights);
            var bookings = BookingEntity.GenerateTestData();

            _context.Bookings.AddRange(bookings);
            _context.SaveChanges();

            // Call the helper class to initialise AutoMapper since it handles multithreading.
            AutoMapperHelper.Initialize();
        }
コード例 #3
0
 public OrdersController(FlightsDBContext context)
 {
     _context = context;
 }
コード例 #4
0
 public CustomersController(FlightsDBContext context)
 {
     _context = context;
 }
コード例 #5
0
 public QueriesService(DbContextOptionsBuilder builder)
 {
     context = new FlightsDBContext(builder.Options);
 }
コード例 #6
0
 public TicketsController(FlightsDBContext context)
 {
     _context = context;
 }
コード例 #7
0
 /// <summary>
 ///     Constructor that allows the passing of a FlightsDBContext
 /// </summary>
 /// <param name="context">FlightsDBContext to be used in this service</param>
 public DefaultBookingService(FlightsDBContext context)
 {
     _context = context;
 }
コード例 #8
0
 /// <summary>
 ///     Constructor that allows the passing of a FlightsDBContext
 /// </summary>
 /// <param name="context">FlightsDBContext to be used in this service</param>
 public DefaultAvailabilityService(FlightsDBContext context)
 {
     _context = context;
 }
コード例 #9
0
 public DepartureCitiesController(FlightsDBContext context)
 {
     _context = context;
 }
コード例 #10
0
 public CommandsService(DbContextOptionsBuilder builder)
 {
     context = new FlightsDBContext(builder.Options);
 }
コード例 #11
0
 public ArrivalCitiesController(FlightsDBContext context)
 {
     _context = context;
 }
コード例 #12
0
 /// <summary>
 ///     Constructor that allows the passing of a FlightsDBContext
 /// </summary>
 /// <param name="context">FlightsDBContext to be used in this service</param>
 public DefaultFlightService(FlightsDBContext context)
 {
     _context = context;
 }