예제 #1
0
        public void GetAllRemindersShouldReturnAList()
        {
            var userId   = "John";
            var mockRepo = new Mock <IReminderRepository>();

            mockRepo.Setup(repo => repo.GetAllRemindersByUserId(userId)).Returns(this.GetReminders());
            var service = new ReminderService(mockRepo.Object);

            var actual = service.GetAllRemindersByUserId(userId);

            Assert.IsAssignableFrom <List <Reminder> >(actual);
            Assert.NotEmpty(actual);
        }
예제 #2
0
        public void GetAllRemindersShouldReturnEmptyList()
        {
            string userId   = "Sam";
            var    mockRepo = new Mock <IReminderRepository>();

            mockRepo.Setup(repo => repo.GetAllRemindersByUserId(userId)).Returns(new List <Reminder>());
            var service = new ReminderService(mockRepo.Object);

            var actual = service.GetAllRemindersByUserId(userId);

            Assert.IsAssignableFrom <List <Reminder> >(actual);
            Assert.Empty(actual);
        }