public void TestToDoGetAllException() { // Arrange using (var mock = new ToDoMockService()) { using (ToDoController controller = new ToDoController(mock)) { //Act var result = controller.GetAll(); //Assert Assert.IsTrue(result.Data.ToString() == "error", "Exception occur so error."); } } }
public void TestToDoCreateException() { using (var mock = new ToDoMockService()) { // Arrange using (ToDoController controller = new ToDoController(mock)) { // Act ToDoItem item = new ToDoItem(); item.Name = "Test data"; var result = controller.Create(item); //Assert Assert.IsTrue(result.Data.ToString() == "error", "Exception occur so error."); } } }