コード例 #1
0
 public static void InitializeDbForTests(KwaffeurDbContext context)
 {
     context.Customers.Add(new Customer
     {
         Active       = false,
         CustomerType = Domain.Enums.CustomerType.Professional,
         Person       = new Person("Jan", "Janssen", GenderType.Male),
         Address      = new Address("kerkstraat", "23", "brugge", "West-Vlaanderen", null, null),
         ContactData  = new ContactData("*****@*****.**", null, "+324700706043", null, null)
     });
     context.SaveChanges();
 }
コード例 #2
0
        public static KwaffeurDbContext Create()
        {
            var options = new DbContextOptionsBuilder <KwaffeurDbContext>()
                          .UseInMemoryDatabase(Guid.NewGuid().ToString())
                          .Options;

            var context = new KwaffeurDbContext(options);

            context.Database.EnsureCreated();

            //context.Customers.AddRange(new[] {
            //    new Customer { CustomerId = "ADAM", ContactName = "Adam Cogan" },
            //    new Customer { CustomerId = "JASON", ContactName = "Jason Taylor" },
            //    new Customer { CustomerId = "BREND", ContactName = "Brendan Richards" },
            //});

            context.SaveChanges();

            return(context);
        }
コード例 #3
0
 public static void Destroy(KwaffeurDbContext context)
 {
     context.Database.EnsureDeleted();
     context.Dispose();
 }
コード例 #4
0
 public CommandTestBase()
 {
     _context = KwaffeurContextFactory.Create();
 }