コード例 #1
0
        public void DeleteCart_DeletesCart_AndReturnsTrue()
        {
            var target = new ShoppingCartRepository();
            target.AddProductToCart("TestUser", new Product { ProductNumber = "BB-7421" });

            var cart = target.GetById("TestUser");
            Assert.IsNotNull(cart);

            var success = target.Delete("TestUser");

            Assert.IsTrue(success);

            var emptyCart = target.GetById("TestUser");
            Assert.IsNull(emptyCart);
        }
コード例 #2
0
        public void DeleteCart_ReturnsFalse_WhenCartDoesNotExist()
        {
            var target = new ShoppingCartRepository();

            var emptyCart = target.GetById("TestUser");
            Assert.IsNull(emptyCart);

            var success = target.Delete("TestUser");
            Assert.IsFalse(success);
        }