public PackagesForSelectedPageResult(IEnumerable<IPackage> packages, PackagesForSelectedPageQuery query) { this.Packages = packages; this.TotalPackagesOnPage = packages.Count(); this.TotalPackages = query.TotalPackages; this.AllPackages = query.AllPackages; this.Query = query; }
public PackagesForSelectedPageResult(IEnumerable <IPackage> packages, PackagesForSelectedPageQuery query) { this.Packages = packages; this.TotalPackagesOnPage = packages.Count(); this.TotalPackages = query.TotalPackages; this.AllPackages = query.AllPackages; this.Query = query; }
IEnumerable <IPackage> GetFilteredPackagesBeforePagingResults(PackagesForSelectedPageQuery query) { if (query.AllPackages == null) { IQueryable <IPackage> packages = GetPackagesFromPackageSource(query.SearchCriteria); query.TotalPackages = packages.Count(); query.AllPackages = GetFilteredPackagesBeforePagingResults(packages, query.SearchCriteria); } return(query.AllPackages); }
void CreateReadPackagesTask() { var query = new PackagesForSelectedPageQuery(this, allPackages, SearchTerms); packagesForSelectedPageQuery = query; task = taskFactory.CreateTask( () => GetPackagesForSelectedPageResult(query), OnPackagesReadForSelectedPage); }
IEnumerable <IPackage> GetPackagesForSelectedPage(IEnumerable <IPackage> allPackages, PackagesForSelectedPageQuery query) { return(allPackages .Skip(query.Skip) .Take(query.Take)); }
IEnumerable <IPackage> GetPackagesForSelectedPage(PackagesForSelectedPageQuery query) { IEnumerable <IPackage> filteredPackages = GetFilteredPackagesBeforePagingResults(query); return(GetPackagesForSelectedPage(filteredPackages, query)); }
PackagesForSelectedPageResult GetPackagesForSelectedPageResult(PackagesForSelectedPageQuery query) { IEnumerable <IPackage> packages = GetPackagesForSelectedPage(query); return(new PackagesForSelectedPageResult(packages, query)); }
public void ReadPackages_BackgroundTaskHasExceptionWhenItFinishes_PackagesNotUpdated () { CreateViewModel (); viewModel.AddSixFakePackages (); viewModel.ReadPackages (); var query = new PackagesForSelectedPageQuery (viewModel, null, null); taskFactory.FirstFakeTaskCreated.Result = new PackagesForSelectedPageResult (viewModel.FakePackages, query); taskFactory.FirstFakeTaskCreated.IsFaulted = true; CompleteReadPackagesTask (); Assert.AreEqual (0, viewModel.PackageViewModels.Count); }