Пример #1
0
        public static void Initialize(TestContext tc)
        {
            var options = new DbContextOptionsBuilder <Lab1aContext>()
                          .UseInMemoryDatabase(databaseName: "MohawkTestDb").Options;

            _lab1aContext        = new Lab1aContext(options);
            _lab1aDealershipMger = new DealershipMgr();


            //  Car Car1 = new Car { Id = 3, Make = "Chevy", Model = "Impala", Year = 2012, VIN = "123" };
            // Car Car2 = new Car { Id = 4, Make = "Chevy", Model = "Malibu", Year = 2010, VIN = "456" };
            // _lab1aContext.Car.AddRange(Car1, Car2);
            // _lab1aContext.SaveChanges();
        }
Пример #2
0
        public DealershipMgr()
        {
            var options = new DbContextOptionsBuilder <Lab1aContext>()
                          .UseInMemoryDatabase(databaseName: "DealershipMgrDb").Options;

            _context = new Lab1aContext(options);
            Car car1 = new Car {
                Make = "Toyota", Model = "Corolla", Color = "Blue", Year = 2011, VIN = "123"
            };
            Car car2 = new Car {
                Make = "Tesla", Model = "S", Color = "Black", Year = 2019, VIN = "456"
            };
            Car car3 = new Car {
                Make = "VW", Model = "Golf", Color = "Yellow", Year = 2012, VIN = "789"
            };
            Car car4 = new Car {
                Make = "Mazda", Model = "Mazda3", Color = "Purple", Year = 2010, VIN = "987"
            };

            _context.AddRange(car1, car2, car3, car4);
            _context.SaveChangesAsync();
        }
Пример #3
0
 public MemberController(Lab1aContext context)
 {
     _context = context;
 }
Пример #4
0
 public CarController(Lab1aContext context)
 {
     _context = context;
 }
Пример #5
0
 public DealershipController(Lab1aContext context)
 {
     _context = context;
 }