public DeleteShoppingCart ( string id ) : void | ||
id | string | |
return | void |
public void DeleteShoppingCart_ShoppingCartItem_For_An_User() { var shoppingCartRepository = new MockShoppingCartRepository(); shoppingCartRepository.DeleteDelegate = (userId) => { Assert.AreEqual("JohnDoe", userId); return true; }; var target = new ShoppingCartController(shoppingCartRepository, new MockProductRepository()); target.DeleteShoppingCart("JohnDoe"); }
public void DeleteShoppingCart_Throws_ForUnknownUser() { var shoppingCartRepository = new MockShoppingCartRepository(); shoppingCartRepository.DeleteDelegate = s => false; HttpResponseException caughtException = null; var target = new ShoppingCartController(shoppingCartRepository, new MockProductRepository()); try { target.DeleteShoppingCart("UnknownUser"); } catch (HttpResponseException ex) { caughtException = ex; } Assert.AreEqual(System.Net.HttpStatusCode.NotFound, caughtException.Response.StatusCode); }