public AthleteHealthQuery GetHealthHistory(AthleteHealthQuery query) { var healths = DataContext.Queryable<AthleteHealth>().Where(x => x.Athlete.Equals(query.Athlete)); var pager = new Pager<AthleteHealth>( healths, query.PagingData.PageOffset, query.PagingData.PageSize, query.PagingData.RequestsLastPage); query.AthleteHealthHistory = pager.GetPagedItems().ToList(); query.PagingData.TotalCount = pager.TotalCount; query.PagingData.PageOffset = pager.PageOffset; return query; }
public void AssertFindsHistory() { const int pagesize = 5; var athleteBuilder = new AthleteBuilder(); var athlete = athleteBuilder.Build(); var query = new AthleteHealthQuery {PagingData = BuildPagingData(pagesize), Athlete = athlete}; MemoryDataContext.Clear(); MemoryDataContext.Add(athlete); InsertTestHealthHistory(athlete, pagesize*2); var athleteDataAccess = new AthleteDataAccess(); query = athleteDataAccess.GetHealthHistory(query); Assert.AreEqual(pagesize, query.AthleteHealthHistory.Count); Assert.AreEqual(pagesize*2, query.PagingData.TotalCount); }
public void SetAthleteHealthQuery(AthleteHealthQuery query) { throw new NotImplementedException(); }