private static void SetUpDatabase() { var db = new EFContext(); var customerFacade = new CustomerFacade(new CustomerRepository(db), new AddressRepository(db), null, new PasswordHandler()); var productRepository = new ProductRepository(db); var productFacade = new ProductFacade(productRepository); var auctionFacade = new AuctionFacade(new AuctionRepository(db), productRepository); var customerId = Guid.NewGuid(); customerFacade.Add(customerId, "Elin", "Danielsson", new List <Address>() { new Address { AddressType = AddressType.Home, City = "Nykvarn", Country = "Sweden", Id = Guid.NewGuid(), PostalCode = "15531", Street = "Skärarevägen 8" } }, "elin", "elin", "*****@*****.**"); var adminId = Guid.NewGuid(); customerFacade.Add(adminId, "Gunnar", "Karlsson", new List <Address>() { new Address { AddressType = AddressType.Work, City = "Stockholm", Country = "Sweden", Id = Guid.NewGuid(), PostalCode = "12345", Street = "Gatan 1" } }, "admin", "admin", "*****@*****.**"); IProductFactory prodcuFactory = new ProductFactory(); Supplier supplier = new Supplier { Id = Guid.NewGuid(), Name = "Elin" }; var product = prodcuFactory.Create(ProductType.Antique, Guid.NewGuid(), "Vas", 22, 300, supplier) as AntiqueProduct; product.TimeEpoch = TimeEpoch.Baroque; Customer customer = customerFacade.Get(customerId); IList <Bid> bids = new List <Bid> { new Bid { Amount = 400, Id = Guid.NewGuid(), Customer = customer, Time = DateTime.Now } }; Auction auction = new Auction() { AcceptedPrice = product.GetStartPrice() * (decimal)1.5, Product = product, Id = Guid.NewGuid(), Bids = bids, StartTime = DateTime.Now.AddHours(-2), EndTime = DateTime.Now.AddDays(7) }; db.Suppliers.Add(supplier); db.AntiqueProducts.Add(product); db.Bids.AddRange(bids); db.Auctions.Add(auction); }