public void Test_ProductionCalendarService_GetAllRecords() { RepositoryTestHelper.SetUpGetAllWithSort(_repositoryMock, _testData); var svc = new ProductionCalendarService(_repositoryFactoryMock.Object); var records = svc.GetAllRecords(); _repositoryMock.Verify(m => m.GetAll(It.IsAny <Func <IQueryable <ProductionCalendarRecord>, IOrderedQueryable <ProductionCalendarRecord> > >()), Times.Once()); Assert.Equal(7, records.Count()); Assert.Equal(records[0].CalendarDate, new DateTime(2018, 3, 5)); Assert.Equal(records[6].CalendarDate, new DateTime(2018, 3, 11)); }