public Task <List <IAppEntity> > GetUserAppsAsync(string userId, PermissionSet permissions) { return(localCache.GetOrCreateAsync($"GetUserApps({userId})", async() => { return await indexForApps.GetAppsForUserAsync(userId, permissions); })); }
public async Task <List <IAppEntity> > GetUserAppsAsync(string userId, PermissionSet permissions) { var apps = await localCache.GetOrCreateAsync($"GetUserApps({userId})", () => { return(indexForApps.GetAppsForUserAsync(userId, permissions)); }); return(apps); }
public async Task <List <IAppEntity> > GetUserAppsAsync(string userId, PermissionSet permissions, CancellationToken ct = default) { var apps = await GetOrCreate($"GetUserApps({userId})", () => { return(indexForApps.GetAppsForUserAsync(userId, permissions, ct) !); }); return(apps?.ToList() ?? new List <IAppEntity>()); }
public async Task Should_get_apps_from_index() { var permissions = new PermissionSet("*"); A.CallTo(() => indexForApps.GetAppsForUserAsync("user1", permissions, ct)) .Returns(new List <IAppEntity> { app }); var result = await sut.GetUserAppsAsync("user1", permissions, ct); Assert.Equal(app, result.Single()); }