public void RemoveShoppingCartItem_Throws_ForUnknownItem()
{
var shoppingCartRepository = new MockShoppingCartRepository();
shoppingCartRepository.GetByIdDelegate = (userId) =>
{
return new ShoppingCart(new Collection<ShoppingCartItem>());
};
shoppingCartRepository.RemoveItemFromCartDelegate = (shoppingCart, itemId) =>
{
return false;
};
var target = new ShoppingCartController(shoppingCartRepository, new MockProductRepository());
try
{
target.RemoveShoppingCartItem("JohnDoe", "UnknownProductid");
}
catch (HttpResponseException ex)
{
Assert.AreEqual(System.Net.HttpStatusCode.NotFound, ex.Response.StatusCode);
}
}