MergeShoppingCarts() private method

private MergeShoppingCarts ( string id, string anonymousShoppingCartId ) : bool
id string
anonymousShoppingCartId string
return bool
        public void MergeShoppingCarts_Merges()
        {
            var addProductToCartCalled = false;
            var deleteCartCalled = false;
            var shoppingCartRepository = new MockShoppingCartRepository();
            shoppingCartRepository.GetByIdDelegate = userId =>
                                                         {
                                                             switch (userId)
                                                             {
                                                                 case "newId":
                                                                     return
                                                                         new ShoppingCart(
                                                                             new Collection<ShoppingCartItem>
                                                                                 {new ShoppingCartItem {Id = "item1", Product = new Product()}});
                                                                 case "oldId":
                                                                     return
                                                                         new ShoppingCart(
                                                                             new Collection<ShoppingCartItem>
                                                                                 {new ShoppingCartItem {Id = "item2", Quantity = 1, Product = new Product{ProductNumber = "product1"}}});
                                                                 default:
                                                                     return null;
                                                             }
                                                         };
            shoppingCartRepository.AddProductToCartDelegate = (shoppingCartId, product) =>
                                                                  {
                                                                      Assert.AreEqual("newId", shoppingCartId);
                                                                      Assert.AreEqual("product1", product.ProductNumber);
                                                                      addProductToCartCalled = true;
                                                                  };
            shoppingCartRepository.DeleteDelegate = shoppingCartId =>
                                                        {
                                                            Assert.AreEqual("oldId", shoppingCartId);
                                                            deleteCartCalled = true;
                                                            return true;
                                                        };
            var target = new ShoppingCartController(shoppingCartRepository, new MockProductRepository());

            Assert.IsTrue(target.MergeShoppingCarts("newId", "oldId"));
            Assert.IsTrue(addProductToCartCalled);
            Assert.IsTrue(deleteCartCalled);
        }
        public void MergeShoppingCarts_ReturnsFalse_WhenNothingToMerge()
        {
            var deleteCartCalled = false;
            var shoppingCartRepository = new MockShoppingCartRepository();
            shoppingCartRepository.GetByIdDelegate = userId =>
                                                         {
                                                             switch (userId)
                                                             {
                                                                 case "oldId":
                                                                     return
                                                                         new ShoppingCart(
                                                                             new Collection<ShoppingCartItem>
                                                                                 {new ShoppingCartItem {Id = "item1", Product = new Product()}});
                                                                 case "newId":
                                                                     return
                                                                         new ShoppingCart(
                                                                             new Collection<ShoppingCartItem>());
                                                                 default:
                                                                     return null;
                                                             }
                                                         };
            shoppingCartRepository.DeleteDelegate = shoppingCartId =>
            {
                Assert.AreEqual("oldId", shoppingCartId);
                deleteCartCalled = true;
                return true;
            };
            var target = new ShoppingCartController(shoppingCartRepository, new MockProductRepository());

            Assert.IsFalse(target.MergeShoppingCarts("newId", "oldId"));
            Assert.IsTrue(deleteCartCalled);

        }