Exemplo n.º 1
0
        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
        }
Exemplo n.º 2
0
        private void DeleteButton_Click(object sender, EventArgs e)
        {
            var index = NotesGridView1.CurrentCell.RowIndex;

            NoteController.DeleteNote(index);
            NotesGridView1.DataSource = NoteController.GetBindingSource();
        }
Exemplo n.º 3
0
        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.");
        }