public UnitOfWork(ApplicationDbContext context) { this.context = context; Products = new ProductManager(context); Categories = new CategoryManager(context); Images = new ImageManager(context); Orders = new OrderManager(context); Payments = new PaymentTypeManager(context); Tags = new TagManager(context); CartItems = new CartItemManager(context); ProductPayments = new ProductPaymentsManager(context); ProductTag = new ProductTagsManager(context); OrderProduct = new OrderProductManager(context); }
public OrderProductManagerShould() { // Set string variable prodPath to contain the path to the test database string prodPath = System.Environment.GetEnvironmentVariable("BANGAZON_TEST_DB"); // Create connection to test database and capture in DatabaseConnection variable db DatabaseConnection db = new DatabaseConnection(prodPath); // Set the private DatabaseConnection variable of _db to equal the DatabaseConnection of db _db = db; // Ensure there is a database with tables at the end of the test database connection DatabaseStartup databaseStartup = new DatabaseStartup(_db); /* Set the private OrderProduct variable _OrderProduct to be a new instance of * OrderProduct connected to the test database */ _orderProductManager = new OrderProductManager(_db); _orderManager = new OrderManager(_db); _productManager = new ProductManager(_db); // Create a new Orderz called _orderz for test and set the properties _orderz = new Orderz(); _orderz.CustomerId = 1; _orderz.PaymentTypeId = 1; _orderz.DateCreated = DateTime.Now; // Create a new Product called _product for test and set the properties _product = new Product(); _product.ProductType = "transpotation"; _product.CustomerId = 1; _product.Title = "Bike"; _product.Description = "Blue Bike"; _product.Price = 2.00; _product.Quantity = 2; _product.DateCreated = DateTime.Now; _product2 = new Product(); _product2.ProductType = "transportation"; _product2.CustomerId = 1; _product2.Title = "Horse"; _product2.Description = "Blue Horse"; _product2.Price = 3.00; _product2.Quantity = 4; _product2.DateCreated = DateTime.Now; }