public void UpdateList_NoError() { try { GroceryListAccessor.UpdateList(2, 2, "title2", "title2Updated", "site2"); } catch (InvalidOperationException e) { StringAssert.Contains(e.Message, ""); } return; }
//Example 3 //This test is to make sure the function catches if the new tilte is not already taken. public void UpdateList_Takentitle() { try { GroceryListAccessor.UpdateList(4, 4, "title4", "title3", "site4"); } catch (InvalidOperationException e) { StringAssert.Contains(e.Message, ""); return; } Assert.Fail("The expected exception was not thrown."); }