public void WhenActiveCartWithOneItemAndRemoveItemExpectEmptyCart()
        {
            var activeCart = new CartStateActive(new[] { Product.ProductY });

            var newState = activeCart.Remove(Product.ProductY);

            var isEmptyState = newState.Func(cartStateEmpty => true, cartStateActive => false, cartStatePaid => false);
            Assert.IsTrue(isEmptyState);
        }
        public void WhenActiveCartWithTwoItemsAndRemoveItemExpectActiveCartWithOneItem()
        {
            var activeCart = new CartStateActive(new[] { Product.ProductX, Product.ProductY });

            var newState = activeCart.Remove(Product.ProductY);

            var isActiveState = newState.Func(cartStateEmpty => false, cartStateActive => true, cartStatePaid => false);
            Assert.IsTrue(isActiveState);

            var itemCount = newState.Func(cartStateEmpty => -1, cartStateActive => cartStateActive.Items.Count(), cartStatePaid => -1);
            Assert.That(itemCount, Is.EqualTo(1));
        }
        public void WhenActiveCartWithOneItemAndRemoveItemExpectEmptyCart()
        {
            // arrange
            var activeCart = new CartStateActive(new[] { Product.ProductY });

            // act
            var newState = activeCart.Remove(Product.ProductY);

            // assert
            var emptyState = newState as CartStateEmpty;    //CAST!
            if (emptyState == null)
            {
                Assert.Fail("Expect CartStateEmpty");
            }
        }