Exemple #1
0
        private async Task <Guid> SetupData()
        {
            var cartID = await apiHelper.CreateACart();

            var categoryID1 = await apiHelper.CreateACategory(new CreateCategoryRequest
            {
                Title = "category"
            });

            campaignCategoryID = categoryID1;
            var categoryID2 = await apiHelper.CreateACategory(new CreateCategoryRequest
            {
                Title = "category"
            });

            var productID1 = await apiHelper.CreateAProduct(new CreateProductRequest
            {
                CategoryID = campaignCategoryID,
                Price      = 10m,
                Title      = "Product1"
            });

            var productID2 = await apiHelper.CreateAProduct(new CreateProductRequest
            {
                CategoryID = categoryID2,
                Price      = 5m,
                Title      = "Product2"
            });

            await apiHelper.AddItemToTheCart(cartID, new AddItemRequest
            {
                ProductID = productID1,
                Quantity  = 3
            });

            await apiHelper.AddItemToTheCart(cartID, new AddItemRequest
            {
                ProductID = productID2,
                Quantity  = 1
            });

            var couponID = await apiHelper.CreateACoupon(new CreateCouponRequest
            {
                MinimumCartAmount = 20m,
                Rate = 10m,
                Type = DiscountType.Amount
            });

            await apiHelper.ApplyCouponTheCart(cartID, new ApplyCouponRequest
            {
                CouponID = couponID
            });

            return(cartID);
        }
Exemple #2
0
        private async Task <Guid> SetupData()
        {
            var cartID = await apiHelper.CreateACart();

            var categoryID = await apiHelper.CreateACategory(new CreateCategoryRequest
            {
                Title = "category"
            });

            var productID = await apiHelper.CreateAProduct(new CreateProductRequest
            {
                CategoryID = categoryID,
                Price      = 10m,
                Title      = "Product"
            });

            await apiHelper.AddItemToTheCart(cartID, new AddItemRequest
            {
                ProductID = productID,
                Quantity  = 3
            });

            return(cartID);
        }