Example #1
0
        public async Task AddToCart_Successfull(int cartId, int buyerId, int itemid, int price, string itemName, string description, int stockno, string remarks, string imageName)
        {
            try
            {
                var cart = new AddCart {
                    cartId = cartId, buyerId = buyerId, itemId = itemid, price = price, itemName = itemName, description = description, stockno = stockno, remarks = remarks, imageName = imageName
                };
                var mock = new Mock <IItemRepository>();
                mock.Setup(x => x.AddToCart(cart)).ReturnsAsync(true);
                ItemManager itemManager = new ItemManager(mock.Object);
                var         result      = await itemManager.AddToCart(cart);

                Assert.NotNull(result);
            }
            catch (Exception e)
            {
                Assert.Fail(e.Message);
            }
        }