public void PostCart_NoCartExists_ProductAdded()
        {
            const int newQuantity       = 1;
            const int userIdWithoutCart = 2;
            var       request           = new AddProductToCartRequest
            {
                ProductId                 = existingItem.Id.ProductId,
                MarketplaceSupplierId     = existingItem.Id.MarketplaceSupplierId,
                SecondHandSalesOfferId    = existingItem.Id.SecondHandSalesOfferId,
                SubscriptionItemProductId = existingItem.Id.SubscriptionItemProductId,
                Quantity = newQuantity
            };

            var result = new ShoppingCartApiController(
                LoadCart,
                CreateCart,
                LoadProductBaseData,
                LoadRetailOfferData,
                new HttpContextAccessor().WithLoggedInUser(userIdWithoutCart))
                         .AddProduct(userIdWithoutCart, validShoppingCartId, culture, request);

            Assert.That(result, Is.AssignableTo <ObjectResult>());
            var value = ((ObjectResult)result).Value;

            Assert.That(value, Is.AssignableTo <ShoppingCartResponse>());
            var shoppingCartResponse = (ShoppingCartResponse)value;

            Assert.That(shoppingCartResponse.Items[0].Quantity, Is.EqualTo(newQuantity));
        }
        public void PostCart_InvalidCartId_ReturnsBadRequest(int cartId)
        {
            var request = new AddProductToCartRequest
            {
                ProductId                 = existingItem.Id.ProductId,
                MarketplaceSupplierId     = existingItem.Id.MarketplaceSupplierId,
                SecondHandSalesOfferId    = existingItem.Id.SecondHandSalesOfferId,
                SubscriptionItemProductId = existingItem.Id.SubscriptionItemProductId,
                Quantity = 0
            };

            var result = new ShoppingCartApiController(
                LoadCart,
                CreateCart,
                LoadProductBaseData,
                LoadRetailOfferData,
                new HttpContextAccessor())
                         .AddProduct(0, cartId, culture, request);

            Assert.That(result, Is.AssignableTo <StatusCodeResult>());
            var resultCode = ((StatusCodeResult)result).StatusCode;

            Assert.That(resultCode, Is.EqualTo((int)HttpStatusCode.BadRequest));
        }