예제 #1
0
        public static EarlessContext CreateContext()
        {
            EarlessContext context = new EarlessContext(CreateNewEntityFrameworkContextOptions());

            context.Database.EnsureCreated();
            return(context);
        }
예제 #2
0
        public EarlessContext InitializeContext()
        {
            EarlessContext context = TestDbGenerator.CreateContext();

            TestDbGenerator.Initialize(context);

            productCategories = GetProductCategories(false);
            context.AddRange();

            products = GetProducts(false, productCategories);

            context.AddRange(products);
            context.SaveChanges();

            return(context);
        }
예제 #3
0
 public static void Initialize(EarlessContext context)
 {
     context.Database.EnsureCreated();
 }
예제 #4
0
 public ProductServiceTest()
 {
     context        = mockFactory.InitializeContext();
     productService = new ProductService(context);
     productCount   = context.Products.Count();
 }
예제 #5
0
 public ProductService(EarlessContext context)
 {
     this.context = context;
 }
예제 #6
0
 public OrderLineServiceTest()
 {
     context          = mockFactory.InitializeContext();
     orderLineService = new OrderLineService(context);
     orderService     = new OrderService(context, orderLineService);
 }
예제 #7
0
 public OrderLineService(EarlessContext context)
 {
     this.context = context;
 }
예제 #8
0
 public OrderService(EarlessContext context, IOrderLineService orderLineService)
 {
     this.context          = context;
     this.orderLineService = orderLineService;
 }