Esempio n. 1
0
        public async Task TestInitialize()
        {
            DbContextOptions <FlyingDutchmanAirlinesContext> dbContextOptions =
                new DbContextOptionsBuilder <FlyingDutchmanAirlinesContext>().UseInMemoryDatabase("FlyingDutchman")
                .Options;

            _context = new FlyingDutchmanAirlinesContext_Stub(dbContextOptions);

            Flight flight = new Flight
            {
                FlightNumber = 1,
                Origin       = 1,
                Destination  = 2
            };

            Flight flight2 = new Flight
            {
                FlightNumber = 10,
                Origin       = 3,
                Destination  = 4
            };

            _context.Flight.Add(flight);
            _context.Flight.Add(flight2);
            await _context.SaveChangesAsync();

            _repository = new FlightRepository(_context);
            Assert.IsNotNull(_repository);
        }
Esempio n. 2
0
        public void TestInitialize()
        {
            DbContextOptions <FlyingDutchmanAirlinesContext> dbContextOptions = new DbContextOptionsBuilder <FlyingDutchmanAirlinesContext>().UseInMemoryDatabase("FlyingDutchman").Options;

            _context = new FlyingDutchmanAirlinesContext(dbContextOptions);

            _repository = new CustomerRepository(_context);
            Assert.IsNotNull(_repository);
        }
        public async Task TestInitialize()
        {
            DbContextOptions <FlyingDutchmanAirlinesContext> dbContextOptions =
                new DbContextOptionsBuilder <FlyingDutchmanAirlinesContext>().UseInMemoryDatabase("FlyingDutchman")
                .Options;

            _context = new FlyingDutchmanAirlinesContext_Stub(dbContextOptions);


            SortedList <string, Airport> airports = new SortedList <string, Airport>
            {
                {
                    "GOH",
                    new Airport
                    {
                        AirportId = 0,
                        City      = "Nuuk",
                        Iata      = "GOH"
                    }
                },
                {
                    "PHX",
                    new Airport
                    {
                        AirportId = 1,
                        City      = "Phoenix",
                        Iata      = "PHX"
                    }
                },
                {
                    "DDH",
                    new Airport
                    {
                        AirportId = 2,
                        City      = "Bennington",
                        Iata      = "DDH"
                    }
                },
                {
                    "RDU",
                    new Airport
                    {
                        AirportId = 3,
                        City      = "Raleigh-Durham",
                        Iata      = "RDU"
                    }
                }
            };

            _context.Airport.AddRange(airports.Values);
            await _context.SaveChangesAsync();

            _repository = new AirportRepository(_context);
            Assert.IsNotNull(_repository);
        }
Esempio n. 4
0
        public async Task TestInitialize()
        {
            DbContextOptions <FlyingDutchmanAirlinesContext> dbContextOptions = new DbContextOptionsBuilder <FlyingDutchmanAirlinesContext>().UseInMemoryDatabase("FlyingDutchman").Options;

            _context = new FlyingDutchmanAirlinesContext(dbContextOptions);

            Customer testCustomer = new Customer("Linus Torvalds");

            _context.Customers.Add(testCustomer);
            await _context.SaveChangesAsync();

            _repository = new CustomerRepository(_context);
            Assert.IsNotNull(_repository);
        }
Esempio n. 5
0
 public CustomerRepository(FlyingDutchmanAirlinesContext _context)
 {
     this._context = _context;
 }
Esempio n. 6
0
 public FlightRepository(FlyingDutchmanAirlinesContext _context)
 {
     this._context = _context;
 }
Esempio n. 7
0
 public BookingRepository(FlyingDutchmanAirlinesContext _context)
 {
     this._context = _context;
 }
 public CustomerRepository(FlyingDutchmanAirlinesContext context)
 {
     _context = context;
 }