Ejemplo n.º 1
0
        public void DeleteReminderShouldThrowException()
        {
            var mockRepo = new Mock <IReminderRepository>();
            int Id       = 2;

            mockRepo.Setup(repo => repo.DeletReminder(Id)).Returns(false);
            var service = new ReminderService(mockRepo.Object);

            var actual = Assert.Throws <ReminderNotFoundException>(() => service.DeletReminder(Id));

            Assert.Equal($"Reminder with id: {Id} does not exist", actual.Message);
        }
Ejemplo n.º 2
0
        public void DeleteReminderShouldReturnTrue()
        {
            var mockRepo = new Mock <IReminderRepository>();
            int Id       = 2;
            // --------------------------Update-----------------------------
            Reminder reminder = new Reminder();

            mockRepo.Setup(repo => repo.GetReminderById(Id)).Returns(reminder);
            // --------------------------Update-----------------------------
            mockRepo.Setup(repo => repo.DeletReminder(Id)).Returns(true);
            var service = new ReminderService(mockRepo.Object);
            var actual  = service.DeletReminder(Id);

            Assert.True(actual);
        }