public void DeleteNote_Success() { // Act var response = controller.DeleteNote(defaultDeleteNoteID, DateTime.UtcNow); // Assert Assert.IsNotNull(response, "Response can not be null"); Assert.IsTrue(response.RowAffected > 2, "Note could not be deleted."); //Delete is logged operation, default rows affected is 2 }
private void DeleteButton_Click(object sender, EventArgs e) { var index = NotesGridView1.CurrentCell.RowIndex; NoteController.DeleteNote(index); NotesGridView1.DataSource = NoteController.GetBindingSource(); }
public void DeleteNote_Success() { // Arrange notes = new List <NoteModel>(); notes.Add(noteDataForSuccess); mock.Setup(r => r.DeleteNote(It.IsAny <long>(), DateTime.UtcNow)) .Callback((long id) => notes.Remove(notes.Find(note => note.NoteID == id))) .Returns(noteResponse); //Act var deleteNoteResult = noteController.DeleteNote(defaultDeleteContactId, DateTime.UtcNow); var response = deleteNoteResult as HttpResult <Response <NoteModel> >; //Assert Assert.IsNotNull(response, "Response can't be null"); Assert.IsTrue(notes.Count() == 0, "Note could not be deleted."); }