public void TestReduceMultipleStock()
        {
            //Arrange
            var options = new DbContextOptionsBuilder <BitsAndBobsContext>()
                          .UseInMemoryDatabase(databaseName: "Test10DB")
                          .Options;

            //Act
            using (var context = new BitsAndBobsContext(options))
            {
                var _unitOfWork = new UnitOfWork(context);

                var testProduct1 = new Product
                {
                    ProductName  = "Apple",
                    ProductPrice = 1
                };

                var testProduct2 = new Product
                {
                    ProductName  = "Banana",
                    ProductPrice = 1
                };

                var testLocation = new Location
                {
                    LocationCity = "Springfield"
                };

                var testInventory1 = new Inventory
                {
                    InventoryLocation = testLocation,
                    InventoryProduct  = testProduct1,
                    QuantityAvailable = 5
                };

                var testInventory2 = new Inventory
                {
                    InventoryLocation = testLocation,
                    InventoryProduct  = testProduct2,
                    QuantityAvailable = 5
                };

                context.Add(testProduct1);
                context.Add(testProduct2);
                context.Add(testLocation);
                context.Add(testInventory1);
                context.Add(testInventory2);

                context.SaveChanges();
            }

            //Assert
            using (var context = new BitsAndBobsContext(options))
            {
                var _unitOfWork = new UnitOfWork(context);

                _unitOfWork.Inventories.ReduceStock(1, 1);
                _unitOfWork.Inventories.ReduceStock(2, 3);

                Assert.Equal(4, _unitOfWork.Inventories.GetLocationInventory(1).Where(id => id.InventoryID == 1).FirstOrDefault().QuantityAvailable);
                Assert.Equal(2, _unitOfWork.Inventories.GetLocationInventory(1).Where(id => id.InventoryID == 2).FirstOrDefault().QuantityAvailable);
            }
        }
        public void TestGetAllLocations()
        {
            //Arrange
            var options = new DbContextOptionsBuilder <BitsAndBobsContext>()
                          .UseInMemoryDatabase(databaseName: "Test16DB")
                          .Options;

            //Act
            using (var context = new BitsAndBobsContext(options))
            {
                var _unitOfWork = new UnitOfWork(context);

                var testCustomer = new Customer
                {
                    CustFirstName = "Annie",
                    CustLastName  = "Admin",
                    CustUsername  = "******"
                };

                var testProduct1 = new Product
                {
                    ProductName  = "Apple",
                    ProductPrice = 1
                };

                var testProduct2 = new Product
                {
                    ProductName  = "Banana",
                    ProductPrice = 1
                };

                var testLocation = new Location
                {
                    LocationCity = "Springfield"
                };

                var testLocation2 = new Location
                {
                    LocationCity = "Peoria"
                };

                var testInventory1 = new Inventory
                {
                    InventoryLocation = testLocation,
                    InventoryProduct  = testProduct1,
                    QuantityAvailable = 5
                };

                var testInventory2 = new Inventory
                {
                    InventoryLocation = testLocation,
                    InventoryProduct  = testProduct2,
                    QuantityAvailable = 5
                };

                var testOrderLineItem = new OrderLineItem
                {
                    LineItemProduct = testProduct1,
                    LinePrice       = 2,
                    Quantity        = 2
                };

                var testOrder = new Order
                {
                    OrderCustomer  = testCustomer,
                    OrderDate      = DateTime.Now,
                    OrderLineItems = new List <OrderLineItem> {
                        testOrderLineItem
                    },
                    OrderLocation = testLocation
                };

                context.Add(testCustomer);
                context.Add(testProduct1);
                context.Add(testProduct2);
                context.Add(testLocation);
                context.Add(testLocation2);
                context.Add(testInventory1);
                context.Add(testInventory2);

                context.SaveChanges();

                _unitOfWork.Orders.Add(testOrder);
                _unitOfWork.Complete();
            }

            //Assert
            using (var context = new BitsAndBobsContext(options))
            {
                var _unitOfWork = new UnitOfWork(context);



                Assert.Equal(2, _unitOfWork.Locations.GetAll().Count());
            }
        }
        public void TestGetLocationInventory()
        {
            //Arrange
            var options = new DbContextOptionsBuilder <BitsAndBobsContext>()
                          .UseInMemoryDatabase(databaseName: "Test8DB")
                          .Options;

            //Act
            using (var context = new BitsAndBobsContext(options))
            {
                var _unitOfWork = new UnitOfWork(context);

                var testProduct1 = new Product
                {
                    ProductName  = "Apple",
                    ProductPrice = 1
                };

                var testProduct2 = new Product
                {
                    ProductName  = "Banana",
                    ProductPrice = 1
                };

                var testLocation = new Location
                {
                    LocationCity = "Springfield"
                };

                var testInventory1 = new Inventory
                {
                    InventoryLocation = testLocation,
                    InventoryProduct  = testProduct1,
                    QuantityAvailable = 5
                };

                var testInventory2 = new Inventory
                {
                    InventoryLocation = testLocation,
                    InventoryProduct  = testProduct2,
                    QuantityAvailable = 5
                };

                context.Add(testProduct1);
                context.Add(testProduct2);
                context.Add(testLocation);
                context.Add(testInventory1);
                context.Add(testInventory2);

                context.SaveChanges();
            }

            //Assert
            using (var context = new BitsAndBobsContext(options))
            {
                var _unitOfWork = new UnitOfWork(context);



                Assert.Equal(2, _unitOfWork.Inventories.GetLocationInventory(1).Count());
            }
        }