public async Task <List <SchemeData> > HandleAsync(GetSchemes message) { authorization.EnsureCanAccessInternalArea(); var schemes = await dataAccess.GetCompleteSchemes(); return(schemes.Select(s => schemeMap.Map(s)) .OrderBy(sd => sd.Name) .ToList()); }
public async Task <List <SchemeData> > HandleAsync(GetSchemesExternal message) { authorization.EnsureCanAccessExternalArea(); var schemes = await dataAccess.GetCompleteSchemes(); return(schemes.Where(s => (s.SchemeStatus == SchemeStatus.Approved) || (s.SchemeStatus == SchemeStatus.Withdrawn)) .Select(s => schemeMap.Map(s)) .OrderBy(sd => sd.SchemeName) .ToList()); }
private IGetSchemesDataAccess CreateFakeDataAccess() { IGetSchemesDataAccess dataAccess = A.Fake <IGetSchemesDataAccess>(); scheme1 = A.Fake <Domain.Scheme.Scheme>(); scheme2 = A.Fake <Domain.Scheme.Scheme>(); scheme3 = A.Fake <Domain.Scheme.Scheme>(); var results = new List <Domain.Scheme.Scheme>() { scheme1, scheme2, scheme3 }; A.CallTo(() => dataAccess.GetCompleteSchemes()).Returns(results); return(dataAccess); }