public void WhenEmptyCartAndAddItemExpectActiveCartWithOneItem()
        {
            var emptyCart = new CartStateEmpty();

            var newState = emptyCart.Add(Product.ProductX);

            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 WhenEmptyCartAndAddItemExpectActiveCartWithOneItem()
        {
            // arrange
            var emptyCart = new CartStateEmpty();

            // act
            var newState = emptyCart.Add(Product.ProductX);

            // assert
            var activeState = newState as CartStateActive; //CAST!
            if (activeState != null)
            {
                var itemCount = activeState.Items.Count();
                Assert.That(itemCount, Is.EqualTo(1));
            }
            else
            {
                Assert.Fail("Expect ActiveState");
            }
        }