Example #1
0
 public Task <List <IAppEntity> > GetUserAppsAsync(string userId, PermissionSet permissions)
 {
     return(localCache.GetOrCreateAsync($"GetUserApps({userId})", async() =>
     {
         return await indexForApps.GetAppsForUserAsync(userId, permissions);
     }));
 }
Example #2
0
        public async Task <List <IAppEntity> > GetUserAppsAsync(string userId, PermissionSet permissions)
        {
            var apps = await localCache.GetOrCreateAsync($"GetUserApps({userId})", () =>
            {
                return(indexForApps.GetAppsForUserAsync(userId, permissions));
            });

            return(apps);
        }
Example #3
0
        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>());
        }
Example #4
0
        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());
        }