コード例 #1
0
        public void UpdateReminderShouldReturnTrue()
        {
            int      Id       = 201;
            Reminder reminder = new Reminder {
                Id = 201, Name = "Sports", CreatedBy = "Mukesh", Description = "sports reminder", CreationDate = new DateTime(), Type = "sms"
            };
            var mockRepo = new Mock <IReminderRepository>();

            mockRepo.Setup(repo => repo.UpdateReminder(Id, reminder)).Returns(true);
            var service = new API.Service.ReminderService(mockRepo.Object);


            var actual = service.UpdateReminder(Id, reminder);

            Assert.True(actual);
        }
コード例 #2
0
        public void UpdateReminderShouldThrowException()
        {
            int      Id       = 205;
            Reminder reminder = new Reminder {
                Id = 205, Name = "Books", CreatedBy = "Sachin", Description = "books reminder", CreationDate = new DateTime(), Type = "email"
            };
            var mockRepo = new Mock <IReminderRepository>();

            mockRepo.Setup(repo => repo.UpdateReminder(Id, reminder)).Returns(false);
            var service = new API.Service.ReminderService(mockRepo.Object);


            var actual = Assert.Throws <ReminderNotFoundException>(() => service.UpdateReminder(Id, reminder));

            Assert.Equal("This reminder id not found", actual.Message);
        }