public void GetReminderByIdShouldThrowException() { int Id = 205; Reminder reminder = null; var mockRepo = new Mock <IReminderRepository>(); mockRepo.Setup(repo => repo.GetReminderById(Id)).Returns(reminder); var service = new API.Service.ReminderService(mockRepo.Object); var actual = Assert.Throws <ReminderNotFoundException>(() => service.GetReminderById(Id)); Assert.Equal("This reminder id not found", actual.Message); }
public void GetReminderByIdShouldReturnAReminder() { int Id = 201; Reminder reminder = new Reminder { Id = 201, Name = "Sports", CreatedBy = "Mukesh", Description = "sports reminder", CreationDate = new DateTime(), Type = "email" }; var mockRepo = new Mock <IReminderRepository>(); mockRepo.Setup(repo => repo.GetReminderById(Id)).Returns(reminder); var service = new API.Service.ReminderService(mockRepo.Object); var actual = service.GetReminderById(Id); Assert.NotNull(actual); Assert.IsAssignableFrom <Reminder>(actual); }