public void test_repository_usage() { RepositoryTestClass repositoryTest = new RepositoryTestClass(); IEnumerable <TimeSlot> timeSlots = repositoryTest.GetTimeSlots(); Assert.IsTrue(timeSlots != null); }
public void test_repository_mocking() { List <TimeSlot> timeSlots = new List <TimeSlot>() { new TimeSlot() { TimeSlotId = 1, Description = "Mustang" }, new TimeSlot() { TimeSlotId = 2, Description = "Corvette" } }; Mock <ITimeSlotRepository> mockTimeSlotRepository = new Mock <ITimeSlotRepository>(); mockTimeSlotRepository.Setup(obj => obj.Get()).Returns(timeSlots); RepositoryTestClass repositoryTest = new RepositoryTestClass(mockTimeSlotRepository.Object); IEnumerable <TimeSlot> ret = repositoryTest.GetTimeSlots(); Assert.IsTrue(ret == timeSlots); }
public void test_repository_usage() { RepositoryTestClass repositoryTest = new RepositoryTestClass(); IEnumerable<TimeSlot> timeSlots = repositoryTest.GetTimeSlots(); Assert.IsTrue(timeSlots != null); }
public void test_repository_mocking() { List<TimeSlot> timeSlots = new List<TimeSlot>() { new TimeSlot() { TimeSlotId = 1, Description = "Mustang" }, new TimeSlot() { TimeSlotId = 2, Description = "Corvette" } }; Mock<ITimeSlotRepository> mockTimeSlotRepository = new Mock<ITimeSlotRepository>(); mockTimeSlotRepository.Setup(obj => obj.Get()).Returns(timeSlots); RepositoryTestClass repositoryTest = new RepositoryTestClass(mockTimeSlotRepository.Object); IEnumerable<TimeSlot> ret = repositoryTest.GetTimeSlots(); Assert.IsTrue(ret == timeSlots); }