private string AddToCart(int profileId, int productId, int productPriceId, string currencyCode, int quantity)
        {
            // Delete existing cart item first
            CartService.DeleteCartItemsByProfileIdAndPriceId(profileId, productPriceId, freeItemIncluded: true);

            var profile   = AccountService.GetProfileById(profileId);
            var countryId = profile.GetAttribute <int>("Profile", SystemCustomerAttributeNames.CountryId, UtilityService);
            var country   = ShippingService.GetCountryById(countryId);

            var message = CartService.ProcessItemAddition(
                profileId,
                productId,
                productPriceId,
                country.ISO3166Code,
                quantity,
                disablePhoneOrderCheck: true);

            return(message);
        }
        public void GetWholeOrderTotalPrice_WithScenario_B_ValidOrderValue()
        {
            // [ Scenario B ] =>
            // 5 * A 130 + 2 * 50
            // 5 * B 45 + 45 + 30
            // 1 * C 20
            // [ Total Order Value is: 370 ]

            // Arrange
            double       expected     = 370;
            ICartService _cartService = new CartService();
            Product      prod;

            // Adding 5 A Type Product.
            for (int i = 0; i < 5; i++)
            {
                prod = new Product {
                    Id = "A"
                };
                _cartService.AddProduct(prod);
            }

            // Adding 5 B Type Product.
            for (int i = 0; i < 5; i++)
            {
                prod = new Product {
                    Id = "B"
                };
                _cartService.AddProduct(prod);
            }

            // Adding 1 C Type Product.
            prod = new Product {
                Id = "C"
            };
            _cartService.AddProduct(prod);

            // Act
            decimal actual = _cartService.GetWholeOrderTotalPrice();

            // Assert
            Assert.AreEqual(expected, Convert.ToDouble(actual), 0.001, "Total Order Value is valid.");
        }
Beispiel #3
0
        public void CanLoadCartWithNoItems()
        {
            string databaseName = Guid.NewGuid().ToString();

            var context = new GlobalmanticsContext(new DbContextOptionsBuilder()
                                                   .UseInMemoryDatabase(databaseName: databaseName)
                                                   .Options);
            var userService = new UserService(context);
            var cartService = new CartService(context);

            var user = userService.GetUserByEmail("*****@*****.**");

            context.SaveChanges();
            var cart = cartService.GetCartForUser(user);

            context.SaveChanges();

            cart.CartItems.Count().Should().Be(0);
        }
Beispiel #4
0
        //delete cart
        private void button1_Click(object sender, EventArgs e)
        {
            mm.db.CartDetails.RemoveRange(CartService.Cart.CartDetails);
            mm.db.SaveChanges();
            CartService.RefreshCart(mm.db);
            dataListView1.DataSource = CartService.Cart.CartDetails
                                       .Select(x => new
            {
                Id           = x.Id,
                NumePiesa    = x.Part.Name,
                Cantitate    = x.Quantity,
                PretPerPiesa = x.Price
            })
                                       .ToList();

            mm.ReCheck();

            this.Close();
        }
Beispiel #5
0
        public void Calculate_Shipping_Costs()
        {
            using (new TransactionScope())
            {
                using (var db = new Entities())
                {
                    var sut         = _createSut();
                    var cartService = new CartService();
                    var cart        = cartService.CreateCart();

                    var product = db.Products.First(p => p.Id == 1);
                    cartService.AddProduct(cart.Id, product.Id, 17);

                    // Set shipping costs.
                    setShippingCosts(db, "at", product.ShippingCategoryId, 6.75m, 1.5m);
                    setShippingCosts(db, "de", product.ShippingCategoryId, 8m, 2m);

                    // Act.
                    var resultAt = sut.CalculateShippingCosts(cart.Id, "at");
                    var resultDe = sut.CalculateShippingCosts(cart.Id, "de");

                    // Assert
                    Assert.AreEqual(6.75m + 16 * 1.5m, resultAt);
                    Assert.AreEqual(8m + 16 * 2.0m, resultDe);

                    // ------------------------------------------------------
                    // Add another product with a different shipping category.
                    product = db.Products.First(p => p.ShippingCategoryId != product.ShippingCategoryId);
                    cartService.AddProduct(cart.Id, product.Id, 2);

                    setShippingCosts(db, "at", product.ShippingCategoryId, 0m, 1.1m);
                    setShippingCosts(db, "de", product.ShippingCategoryId, 0m, 2.2m);

                    // Act.
                    resultAt = sut.CalculateShippingCosts(cart.Id, "at");
                    resultDe = sut.CalculateShippingCosts(cart.Id, "de");

                    // Assert
                    Assert.AreEqual((6.75m + 16 * 1.5m) + (1.1m * 2), resultAt);
                    Assert.AreEqual((8m + 16 * 2.0m) + (2.2m * 2), resultDe);
                }
            }
        }
Beispiel #6
0
        private void ButtonAddToCart(object sender, RoutedEventArgs e)
        {
            using (var context = new FarmersMarketContext((Application.Current as App).ConnectionString))
            {
                var cartService   = new CartService(context);
                var sellerProduct = context.SellerProducts.SingleOrDefault(product => product.Id == SellerId);
                var customer      = context.Customers.SingleOrDefault(user => user.UserId == (Application.Current as App).currentUser.Id);


                var cart = new Cart
                {
                    SellerProduct = sellerProduct,
                    Customer      = customer,
                    Count         = sellerProduct.Count
                };
                cartService.AddProductToCart(cart);
            }
            MessageBox.Show("Товар добавлен в корзину");
        }
Beispiel #7
0
        public ActionResult Index(FormCollection c)
        {
            ViewBag.shortcutSubProductList = _productService.GetShortcutSubProduct();
            if (c["itemIDs"].IsNullOrTrimEmpty())
            {
                return(View());
            }

            var itemIDs    = c["itemIDs"].Split(',').ToList();
            var checkedIds = new CartService().CheckedCarts(itemIDs).Select(a => a.CartID);

            if (checkedIds.Any() == false)
            {
                return(View());
            }

            CookieHelper.SetCookie("cartids", string.Join(",", checkedIds));
            return(Redirect("/cart/Settlement"));
        }
Beispiel #8
0
        public void RemoveFromCartTest()
        {
            //Arrange
            MockRepository <Product>  productContext  = new MockRepository <Product>();
            MockRepository <Cart>     cartContext     = new MockRepository <Cart>();
            MockRepository <CartItem> cartItemContext = new MockRepository <CartItem>();

            CartService cart = new CartService(productContext, cartContext, cartItemContext);

            cart.AddToCart(context.Object, "2");

            var cartId = (cartContext.Collection().ToList()[0]).CartItems.ToList()[0].Id;

            //Act
            cart.RemoveFromCart(context.Object, cartId);

            //Assert
            Assert.IsTrue((cartContext.Collection().ToList()[0]).CartItems.Count == 0);
        }
Beispiel #9
0
        public void TransformCart_Works_Correctly()
        {
            var cart = new Cart
            {
                Items = new List <CartItem> {
                    new CartItem {
                        ProductId = 1, Quantity = 4
                    }
                }
            };

            var products = new List <ProductDTO>
            {
                new ProductDTO
                {
                    Id       = 1,
                    ImageUrl = "image1.jpg",
                    Name     = "Test",
                    Order    = 0,
                    Price    = 1.11m
                }
            };

            var model = new PagedProductDTO
            {
                Products = products
            };
            var product_data_mock = new Mock <IProductData>();

            product_data_mock
            .Setup(c => c.GetProducts(It.IsAny <ProductFilter>())).Returns(model);

            var cart_store_mock = new Mock <ICartStore>();

            cart_store_mock.Setup(c => c.Cart).Returns(cart);

            var cart_service = new CartService(product_data_mock.Object, cart_store_mock.Object);

            var result = cart_service.TransformCart();

            Assert.Equal(4, result.ItemsCount);
            Assert.Equal(1.11m, result.Items.First().Key.Price);
        }
        public ActionResult PayexPurchase(int id)
        {
            var cart = CartService.GetCartById(id);

            var payexRespone = PayexService.initialize8(cart);

            if (!PayexService.Initialize8Successfull(payexRespone))
            {
                log.Debug("Initialize8 Errorcode: " + payexRespone.ErrorCode + " Description: " + payexRespone.Description);
                //TODO: visa cartsidan med en felmedelande

                TempData["Init8Error"] = "Det gick inte att slutföra köpet";
                return(RedirectToAction("Index", "Cart", new { id = cart.Id }));
            }
            else
            {
                return(Redirect(payexRespone.RedirectURL));
            }
        }
Beispiel #11
0
        public ActionResult SubmitOrder(string Remark)
        {
            var stocks = CartService.getEachProductStocks();

            for (int i = 0; i < currentCart.Count; i++)
            {
                if (stocks[i] < currentCart.cartItems[i].Quantity)
                {
                    var images = CartService.getEachProductImages(db);
                    ViewBag.Stocks      = stocks;
                    ViewBag.Images      = images;
                    ViewBag.CheckStocks = false;
                    return(View("ShoppingCart"));
                }
            }
            Session["Remark"]     = Remark;
            Session["CartToHere"] = true;
            return(RedirectToAction("Order_Customer", "Home"));
        }
        public ActionResult DelProduct(int id)
        {
            var             CartService = new CartService();
            OuikumTempOrder model       = new OuikumTempOrder();

            try
            {
                TempCart tCart  = new TempCart();
                var      svCart = new CartService();
                Deletet(id);
            }
            catch (Exception ex)
            {
                CreateLogFiles(ex);
            }


            return(Json(new { IsResult = svCart.IsResult, MsgError = GenerateMsgError(svCart.MsgError), ID = model.TOrderID }));
        }
        public void Should_Add_New_Lines()
        {
            //Arrange
            Product product1 = new Product {
                Id = "1", Name = "Product1", Description = "Test Desc1", Price = 1, ProductType = ProductType.Bags
            };
            Product product2 = new Product {
                Id = "2", Name = "Product2", Description = "Test Desc2", Price = 2, ProductType = ProductType.PaperMask
            };
            var cartId   = Guid.NewGuid();
            var expected = new Cart
            {
                Id          = cartId,
                DateCreated = DateTime.Now,
                LineItems   = new List <LineItem>()
            };
            var         mockCartRepository = new Mock <ICartRepository>();
            CartService cart = new CartService(mockCartRepository.Object);

            mockCartRepository.Setup(m => m.GetById(cartId))
            .Returns(expected);

            // Act
            cart.AddItem(cartId, new LineItem {
                Product = product1, Quantity = 1
            });
            cart.AddItem(cartId, new LineItem {
                Product = product2, Quantity = 1
            });
            var result = mockCartRepository.Object.GetById(cartId);

            //Assert
            mockCartRepository.Verify(t => t.AddOrUpdate(It.IsAny <Cart>()), Times.Exactly(2));
            Assert.AreEqual(result.LineItems.Count, 2);
            Assert.AreEqual(result.LineItems[0].Product, product1);
            Assert.AreEqual(result.LineItems[0].Quantity, 1);
            Assert.AreEqual(result.LineItems[0].Subtotal, 1);
            Assert.AreEqual(result.LineItems[1].Product, product2);
            Assert.AreEqual(result.LineItems[1].Quantity, 1);
            Assert.AreEqual(result.LineItems[1].Subtotal, 2);
            Assert.AreEqual(result.GrossTotal, 3);
        }
Beispiel #14
0
        static void Main(string[] args)
        {
            IAccount myAccount = new Account()
            {
                Currency = Currency.ILS, Name = "Basel", PaymentMethods = new List <ICard>()
                {
                    new MasterCard {
                        Number = "20506070", Password = "******", Provider = "PayPal", Amount = 300, Currency = Currency.USD
                    }
                }
            };

            IStore store           = new Store();
            ICart  myCart          = new Cart();
            var    myPaymentMethod = myAccount.PaymentMethods.Single();

            ILoggingService        loggingService        = new LoggingService();
            ICartService           cartService           = new CartService();
            IStoreLocalizerService storeLocalizerService = new StoreLocalizerService();

            myAccount.IsLoggedIn = true;

            //fill My Store
            store.AddItem(new Item(id: 1, name: "MacBook Pro", category: ItemCategory.Electronics, price: 100), 10);
            store.AddItem(new Item(id: 1, name: "MacBook Pro", category: ItemCategory.Electronics, price: 100), 5);
            store.AddItem(new Item(id: 2, name: "T-Shirt", category: ItemCategory.Clothes, price: 7), 5);

            //localize store
            store = storeLocalizerService.LocalizeStore(store, myAccount.Currency);

            //init my cart
            myCart.AddPaymentMethod(myPaymentMethod);

            //fill my cart
            cartService.AddToCart(store, myCart, 1, 3);
            cartService.AddToCart(store, myCart, 2, 8);

            //Process Payment
            loggingService.Log($"My Balance: {myPaymentMethod.Amount}");
            cartService.ProcessPaymentFor(store, myCart, myAccount);
            loggingService.Log($"My Balance: {myPaymentMethod.Amount}");
        }
        // Add an item to the shopping cart
        // If a current user exists, add to their cart
        // If no current user, create a user and then add to their cart
        public JsonResult AddToCart(int productId)
        {
            int userId;
            int cartId;
            var userIdCookie = Request.Cookies["User ID"];
            var cartIdCookie = Request.Cookies["Cart ID"];

            if (userIdCookie != null)
            {
                string userIdString = userIdCookie.Value;
                bool   parsed       = int.TryParse(userIdString, out userId);
            }
            else
            {
                var user = UserService.CreateUser();
                userId = user.UserId;

                HttpCookie userCookie = new HttpCookie("User ID");
                userCookie.Value = userId.ToString();
                Response.Cookies.Add(userCookie);
            }

            if (cartIdCookie != null)
            {
                string cartIdString = cartIdCookie.Value;
                bool   p            = int.TryParse(cartIdString, out cartId);
            }
            else
            {
                var cart = CartService.CreateCart(userId);
                cartId = cart.CartId;
                HttpCookie cartCookie = new HttpCookie("Cart ID");
                cartCookie.Value = cartId.ToString();
                Response.Cookies.Add(cartCookie);
            }

            CartService.UpdateCart(cartId, productId, 1);

            var result = new { status = "New", cartId = cartId };

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
Beispiel #16
0
        public void CanGetSummaryViewModel()
        {
            IRepository <Cart>     carts     = new MockContext <Cart>();
            IRepository <Product>  products  = new MockContext <Product>();
            IRepository <Order>    orders    = new MockContext <Order>();
            IRepository <Customer> customers = new MockContext <Customer>();

            products.Insert(new Product {
                Id = "1", Price = 10.00m
            });
            products.Insert(new Product {
                Id = "2", Price = 5.00m
            });

            Cart cart = new Cart();

            cart.CartItems.Add(new CartItem {
                ProductId = "1", Quantity = 2
            });
            cart.CartItems.Add(new CartItem {
                ProductId = "2", Quantity = 1
            });

            carts.Insert(cart);

            ICartService  cartService  = new CartService(products, carts);
            IOrderService orderService = new OrderService(orders);
            var           controller   = new CartController(cartService, orderService, customers);
            var           httpContext  = new MockHttpContext();

            httpContext.Request.Cookies.Add(new System.Web.HttpCookie("eCommerceCart")
            {
                Value = cart.Id
            });
            controller.ControllerContext = new System.Web.Mvc.ControllerContext(httpContext, new System.Web.Routing.RouteData(), controller);

            var result      = controller.CartSummary() as PartialViewResult;
            var cartSummary = (CartSummaryViewModel)result.ViewData.Model;

            Assert.AreEqual(3, cartSummary.CartCount);
            Assert.AreEqual(25.00m, cartSummary.CartTotal);
        }
Beispiel #17
0
        private void CartForm_Load(object sender, EventArgs e)
        {
            if (CartService.Cart.Id > 0)
            {
                CartService.RefreshCart(mm.db);
                if (CartService.Cart.CartDetails != null)
                {
                    dataListView1.DataSource = CartService.Cart.CartDetails
                                               .Select(x => new
                    {
                        Id           = x.Id,
                        NumePiesa    = x.Part.Name,
                        Cantitate    = x.Quantity,
                        PretPerPiesa = x.Price
                    })
                                               .ToList();

                    dataListView1.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
                    dataListView1.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize);
                }
            }
            else if (mm.db.Carts.Where(c => c.IsSold == false).Any())
            {
                var lastCart = mm.db.Carts
                               .Where(cart => cart.IsSold == false)
                               .ToList()
                               .FirstOrDefault();
                dataListView1.DataSource = lastCart.CartDetails
                                           .Select(c => new
                {
                    Id           = c.Id,
                    NumePiesa    = c.Part.Name,
                    Cantitate    = c.Quantity,
                    PretperPiesa = c.Price
                }
                                                   ).ToList();
                CartService.Cart.CartDetails = lastCart.CartDetails;
                CartService.Cart             = lastCart;
                dataListView1.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
                dataListView1.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize);
            }
        }
        public void RemoveIdEntry_WhenPassedCookieIsValid()
        {
            // Arrange
            var storeService = new Mock <IStoreService>();
            var service      = new CartService(storeService.Object);
            var itemId       = "adasdasd";
            var list         = new List <string>()
            {
                "dsa;dsa", "aksdjask", "adasdasd"
            };
            var cookie = new HttpCookie("store-items", string.Join(",", list));

            // Act
            var newCookie     = service.DeleteItemFromCookie(cookie, itemId);
            var extractedList = newCookie.Value.Split(',').ToList();

            // Assert
            Assert.AreEqual(2, extractedList.Count);
            Assert.IsTrue(!extractedList.Contains(itemId));
        }
Beispiel #19
0
        public void CartService_AddToCart_WorksCorrect()
        {
            var cart = new Cart
            {
                Items = new List <CartItem>()
            };

            var productData = new Mock <IProductService>();
            var cartStore   = new Mock <ICartStore>();

            cartStore.Setup(c => c.Cart).Returns(cart);

            var cartService = new CartService(productData.Object, cartStore.Object);

            cartService.AddToCart(5);

            Assert.Equal(1, cart.ItemsCount);
            Assert.Equal(1, cart.Items.Count);
            Assert.Equal(5, cart.Items[0].ProductId);
        }
Beispiel #20
0
        private void AddToCartForSession([FromServices] CartService srv, int prdId, int quantity)
        {
            var sessionCart = HttpContext.Session.GetString("Cart");
            var cart        = new Cart();

            if (sessionCart == null)
            {
                srv.AddCartItemForSession(prdId, quantity, cart);
            }
            else
            {
                cart = JsonConvert.DeserializeObject <Cart>(sessionCart);
                var prdCart = cart.CartItems.FirstOrDefault(x => x.ProductId == prdId);
                srv.AddCartItemForSession(prdId, quantity, cart);
            }
            var strCart = JsonConvert.SerializeObject(cart);

            HttpContext.Session.SetString("Cart", strCart);
            ViewData["ItemCount"] = cart.Quantity;
        }
        public void ReturnCorrectList_WhenInputIsValid()
        {
            // Arrange
            var serviceMock = new Mock <IStoreService>();

            var service = new CartService(serviceMock.Object);
            var list    = new List <string>()
            {
                Guid.NewGuid().ToString(), Guid.NewGuid().ToString()
            };
            var cookie = new HttpCookie(CookieName, string.Join(",", list));

            serviceMock.Setup(x => x.GetStoreItemById(It.IsAny <Guid>()));

            // Act
            var extractedList = service.ExtractItemsFromCookie(cookie).ToList();

            // Assert
            serviceMock.Verify(x => x.GetStoreItemById(It.IsAny <Guid>()), Times.Exactly(2));
        }
        public void Can_Checkout_And_Submit_Order()
        {
            // Arrange - create a mock order repository
            Mock <IRepository <Order> > mock = new Mock <IRepository <Order> >();
            // Arrange - create a cart with one item
            CartService cart = new CartService();

            cart.AddItem(new Product(), 1);
            // Arrange - create an instance of the controller
            OrderController target = new OrderController(mock.Object, cart);

            // Act - try to checkout
            RedirectToActionResult result =
                target.Checkout(new Order()) as RedirectToActionResult;

            // Assert - check that the order has been stored
            mock.Verify(m => m.Update(It.IsAny <Order>()), Times.Once);
            // Assert - check that the method is redirecting to the Completed action
            Assert.Equal("Completed", result.ActionName);
        }
        public void Cannot_Checkout_Empty_Cart()
        {
            // Arrange
            Mock <IRepository <Order> > mock = new Mock <IRepository <Order> >();

            CartService cart  = new CartService();
            Order       order = new Order();

            OrderController target = new OrderController(mock.Object, cart);

            // Act
            ViewResult result = target.Checkout(order) as ViewResult;

            // Assert - Check if order hasn't been stored
            mock.Verify(m => m.Update(It.IsAny <Order>()), Times.Never);
            // Check if the method is returning the default view
            Assert.True(string.IsNullOrEmpty(result.ViewName));
            // Passing invalid to ModelState
            Assert.False(result.ViewData.ModelState.IsValid);
        }
        public IActionResult ReviewStep()
        {
            var user   = HttpContext.User.Identity.Name;
            var cart   = CartService.GetCart(this.HttpContext);
            var cartId = cart.ShoppingCartId;

            var cartModel = new ShoppingCartViewModel
            {
                CartItems = _cartService.GetCartItems(cartId),
                CartTotal = _cartService.GetTotal(cartId)
            };

            var accounts     = _accountService.GetAllAccounts();
            var accountmodel = _accountService.GetLoggedInAccount(user);

            _myModel.cartItems = cartModel;
            _myModel.account   = accountmodel;

            return(View(_myModel));
        }
        public IHttpActionResult Remove(string productId)
        {
            SetCartToken();

            if (string.IsNullOrWhiteSpace(CartId) || string.IsNullOrWhiteSpace(productId))
            {
                return(BadRequest());
            }

            var cart = CartService.GetCart(CartId);

            if (cart.Id != CartId || cart.Products.All(x => x.Id != productId))
            {
                return(NotFound());
            }

            CartService.DeleteProduct(CartId, productId);

            return(Ok());
        }
        public IHttpActionResult Get()
        {
            SetCartToken();

            if (string.IsNullOrWhiteSpace(CartId))
            {
                return(Ok(new CompleteProductResponse()));
            }

            var cart = CartService.GetCart(CartId);

            if (cart.Id != CartId)
            {
                return(NotFound());
            }

            var cartResponse = CreateProductsResponse(cart);

            return(Ok(cartResponse));
        }
        public HttpResponseMessage GetCart(string key)
        {
            HttpResponseMessage response    = new HttpResponseMessage(HttpStatusCode.Unused);
            CartService         cartservice = new CartService();
            List <Cart>         cart        = cartservice.Read();
            int id = cartservice.GetIndex(key);

            if (id != -1)
            {
                Cart   ca       = cart[id];
                string cartJSON = JsonConvert.SerializeObject(ca, Formatting.Indented);
                response         = new HttpResponseMessage(HttpStatusCode.OK);
                response.Content = new StringContent(cartJSON, Encoding.UTF8, "application/json");
            }
            else
            {
                response = new HttpResponseMessage(HttpStatusCode.ExpectationFailed);
            }
            return(response);
        }
Beispiel #28
0
        public void GetCartItemsTest()
        {
            //Arrange
            MockRepository <Product>  productContext  = new MockRepository <Product>();
            MockRepository <Cart>     cartContext     = new MockRepository <Cart>();
            MockRepository <CartItem> cartItemContext = new MockRepository <CartItem>();

            productContext.Insert(new Product {
                Id = "2"
            });
            CartService cart = new CartService(productContext, cartContext, cartItemContext);

            cart.AddToCart(context.Object, "2");

            //Act
            List <ShoppingCartItemViewModel> items = cart.GetCartItems(context.Object);

            //Assert
            Assert.IsTrue(items.Count == 1);
        }
        public void CartInsert(int productId, int sizeId)
        {
            Cart     cart = GetOrSetCart();
            CartItem item = cart.Items.Where(x => x.Product.ProductID == productId && x.Size.SizeID == sizeId).FirstOrDefault();

            if (item != null)
            {
                item.Quantity++;
                CartService.UpdateCartItem(item);
            }
            else
            {
                item          = new CartItem();
                item.Product  = ProductService.GetProducts(productId).FirstOrDefault();
                item.Size     = SizeService.GetSizes(sizeId).FirstOrDefault();
                item.Quantity = 1;

                CartService.CreateCartItem(cart, item);
            }
        }
Beispiel #30
0
        public async void CreateCart()
        {
            DbContextOptions <StoreDbContext> options = new DbContextOptionsBuilder <StoreDbContext>()
                                                        .UseInMemoryDatabase("CreateCart")
                                                        .Options;

            using (StoreDbContext storeDb = new StoreDbContext(options))
            {
                CartService ps = new CartService(storeDb, _moqManager.Object);

                Carts carts = new Carts()
                {
                    Email = "*****@*****.**"
                };

                var Cart = await ps.CreateCart(carts);

                Assert.Equal(carts.Email, Cart.Email);
            }
        }