예제 #1
0
        public void DeleteShouldThrowException()
        {
            int    noteId   = 121;
            string userId   = "Mukesh";
            var    mockRepo = new Mock <INoteRepository>();

            mockRepo.Setup(repo => repo.DeleteNote(userId, noteId)).Returns(false);
            var service = new NoteService.Service.NoteService(mockRepo.Object);

            var actual = Assert.Throws <NoteNotFoundExeption>(() => service.DeleteNote(userId, noteId));
        }
예제 #2
0
        public void DeleteNoteShouldReturnTrue()
        {
            int    noteId   = 101;
            string userId   = "Mukesh";
            var    mockRepo = new Mock <INoteRepository>();

            mockRepo.Setup(repo => repo.DeleteNote(userId, noteId)).Returns(true);
            var service = new NoteService.Service.NoteService(mockRepo.Object);

            var actual = service.DeleteNote(userId, noteId);

            Assert.True(actual);
        }