Пример #1
0
        public async Task InvalidatesTheCache()
        {
            var apiClient    = Substitute.For <IApiClient>();
            var cache        = new InMemoryBlobCache();
            var modelService = new ModelService(apiClient, cache, Substitute.For <IAvatarProvider>());
            var user         = await modelService.InsertUser(new AccountCacheItem(CreateOctokitUser("octocat")));

            Assert.Equal(1, (await cache.GetAllObjects <AccountCacheItem>()).Count());

            await modelService.InvalidateAll();

            Assert.Equal(0, (await cache.GetAllObjects <AccountCacheItem>()).Count());
        }
        public async Task InvalidatesTheCache()
        {
            var apiClient = Substitute.For<IApiClient>();
            var cache = new InMemoryBlobCache();
            var modelService = new ModelService(apiClient, cache, Substitute.For<IAvatarProvider>());
            var user = await modelService.InsertUser(new AccountCacheItem(CreateOctokitUser("octocat")));
            Assert.Equal(1, (await cache.GetAllObjects<AccountCacheItem>()).Count());

            await modelService.InvalidateAll();

            Assert.Equal(0, (await cache.GetAllObjects<AccountCacheItem>()).Count());
        }