Esempio n. 1
0
        public void CreateReminderShouldThrowException()
        {
            var      mockRepo = new Mock <IReminderRepository>();
            Reminder reminder = new Reminder {
                Id = 201, Name = "Sports", CreatedBy = "Mukesh", Description = "sports reminder", CreationDate = new DateTime(), Type = "email"
            };

            mockRepo.Setup(repo => repo.GetReminderById(201)).Returns(reminder);
            var service = new API.Service.ReminderService(mockRepo.Object);


            var actual = Assert.Throws <ReminderNotCreatedException>(() => service.CreateReminder(reminder));

            Assert.Equal("This reminder id already exists", actual.Message);
        }
Esempio n. 2
0
        public void CreateReminderShouldReturnReminder()
        {
            var      mockRepo = new Mock <IReminderRepository>();
            Reminder reminder = new Reminder {
                Id = 203, Name = "Books", CreatedBy = "Sachin", Description = "books reminder", CreationDate = new DateTime(), Type = "email"
            };

            mockRepo.Setup(repo => repo.CreateReminder(reminder)).Returns(reminder);
            var service = new API.Service.ReminderService(mockRepo.Object);


            var actual = service.CreateReminder(reminder);

            Assert.NotNull(actual);
            Assert.IsAssignableFrom <Reminder>(actual);
        }