public async void ItShouldUpdateAnOrderItem()
        {
            //Given
            EFCoreOrderRepository orderRepo = new EFCoreOrderRepository(ctx);
            EFCoreUserRepository  userRepo  = new EFCoreUserRepository(ctx);
            await userRepo.Add(mockUser);

            VendorAppUser newUser = (await userRepo.GetAll()).ElementAt(0);

            //When
            mockOrder.User = newUser;
            await orderRepo.Add(mockOrder);

            Order tempOrder = (await orderRepo.GetAll()).ElementAt(0);

            tempOrder.OrderItems = new List <OrderItem> {
                mockOrderItem
            };
            await orderRepo.Update(tempOrder);

            OrderItem tempOrderItem = (await orderRepo.GetAllOrderItems()).ElementAt(0);

            tempOrderItem.ProductName = "New Product Name";
            await orderRepo.UpdateOrderItem(tempOrderItem);

            //Then
            OrderItem actualOrderItem = (await orderRepo.GetAllOrderItems()).ElementAt(0);

            Assert.Equal("New Product Name", actualOrderItem.ProductName);
        }
        public async void ItShouldRemoveAnOrderItem()
        {
            //Given
            EFCoreOrderRepository orderRepo = new EFCoreOrderRepository(ctx);
            EFCoreUserRepository  userRepo  = new EFCoreUserRepository(ctx);
            await userRepo.Add(mockUser);

            VendorAppUser newUser = (await userRepo.GetAll()).ElementAt(0);

            //When
            mockOrder.User = newUser;
            await orderRepo.Add(mockOrder);

            Order tempOrder = (await orderRepo.GetAll()).ElementAt(0);

            tempOrder.OrderItems = new List <OrderItem> {
                mockOrderItem
            };
            await orderRepo.Update(tempOrder);

            OrderItem tempOrderItem = (await orderRepo.GetAllOrderItems()).ElementAt(0);
            await orderRepo.RemoveOrderItem(tempOrderItem.ID);

            //Then
            Assert.Equal(0, (await orderRepo.GetAllOrderItems()).Count());
        }
        public async void ItShouldUpdateAOrder()
        {
            //Given
            EFCoreOrderRepository orderRepo = new EFCoreOrderRepository(ctx);
            EFCoreUserRepository  userRepo  = new EFCoreUserRepository(ctx);
            await userRepo.Add(mockUser);

            VendorAppUser newUser = (await userRepo.GetAll()).ElementAt(0);

            //When
            mockOrder.User = newUser;
            await orderRepo.Add(mockOrder);

            Order tempOrder = (await orderRepo.GetAll()).ElementAt(0);

            tempOrder.OrderItems = new List <OrderItem> {
                mockOrderItem
            };
            await orderRepo.Update(tempOrder);

            //Then
            Order actualOrder = (await orderRepo.GetAll()).ElementAt(0);

            Assert.Equal(1, actualOrder.OrderItems.Count());
        }
        public async void ItShouldCreateAOrder()
        {
            //Given
            EFCoreOrderRepository orderRepo = new EFCoreOrderRepository(ctx);
            EFCoreUserRepository  userRepo  = new EFCoreUserRepository(ctx);
            await userRepo.Add(mockUser);

            VendorAppUser newUser = (await userRepo.GetAll()).ElementAt(0);

            //When
            mockOrder.User = newUser;
            await orderRepo.Add(mockOrder);

            //Then
            Order actualOrder = (await orderRepo.GetAll()).ElementAt(0);

            Assert.Equal(1, actualOrder.ID);
        }
        public async void ItShouldRemoveAOrder()
        {
            //Given
            EFCoreOrderRepository orderRepo = new EFCoreOrderRepository(ctx);
            EFCoreUserRepository  userRepo  = new EFCoreUserRepository(ctx);
            await userRepo.Add(mockUser);

            VendorAppUser newUser = (await userRepo.GetAll()).ElementAt(0);

            //When
            mockOrder.User = newUser;
            await orderRepo.Add(mockOrder);

            Order tempOrder = (await orderRepo.GetAll()).ElementAt(0);
            await orderRepo.Delete(tempOrder.ID);

            //Then
            Assert.Equal(0, (await orderRepo.GetAll()).Count());
        }
        public async void ItShouldUpdateUsersNumCartItems()
        {
            //Given
            EFCoreCartRepository cartRepo = new EFCoreCartRepository(ctx);
            EFCoreUserRepository userRepo = new EFCoreUserRepository(ctx);
            VendorAppUser        newUser  = new VendorAppUser();

            //When
            await userRepo.Add(newUser);


            newUser = (await userRepo.GetAll()).ElementAt(0);



            await cartRepo.AddItemToCart(newUser.Id, "product", "location", 1);

            //Then
            VendorAppUser actualUser = (await userRepo.GetAll()).ElementAt(0);

            Assert.Equal(1, actualUser.NumCartItems);
        }
        public async void ItShouldClearUsersCart()
        {
            EFCoreCartRepository cartRepo = new EFCoreCartRepository(ctx);
            EFCoreUserRepository userRepo = new EFCoreUserRepository(ctx);
            VendorAppUser        newUser  = new VendorAppUser();

            await userRepo.Add(newUser);

            newUser = (await userRepo.GetAll()).ElementAt(0);

            Cart newCart = new Cart
            {
                User = newUser
            };

            await cartRepo.Add(newCart);

            List <Cart> fetched = await cartRepo.GetAll();

            await cartRepo.Delete(fetched.ElementAt(0).ID);

            Assert.Equal(0, (await cartRepo.GetAll()).Count());
        }