public void RemoveBook_NotExistingBook() { StringWriter output = new StringWriter(); ModelStore model = ModelMockup(); Viewer view = new Viewer(output); Controller control = new Controller(model, view); Customer c = model.GetCustomer(2); Book b = model.GetBook(2); try { control.RemoveBook(c, b); Assert.Fail("Expected exception was not thrown."); } catch(Exception ex) { Assert.AreEqual("Book doesn't exist in Customers ShoppingCart.", ex.Message); } }
public void RemoveBook_DeleteBook() { StringWriter output = new StringWriter(); ModelStore model = ModelMockup(); Viewer view = new Viewer(output); Controller control = new Controller(model, view); Customer c = model.GetCustomer(2); Book b = model.GetBook(5); control.RemoveBook(c, b); Assert.AreEqual(model.GetCustomer(2).ShoppingCart.Items.Find(itm => itm.BookId == b.Id), null); }