Пример #1
0
        public void Refresh_not_null_success()
        {
            var cacheRegistry = Substitute.For <ICacheRegistry>();
            var siteCaches    = new SiteCaches(cacheRegistry);
            var rootAu        = new TestSite
            {
                Key      = Guid.NewGuid(),
                SiteName = "AU"
            };
            var rootNz = new TestSite
            {
                Key      = Guid.NewGuid(),
                SiteName = "NZ"
            };
            var cacheAu = siteCaches.Get(rootAu);
            var cacheNz = siteCaches.Get(rootNz);

            siteCaches.Refresh(rootAu);

            cacheRegistry.Received(1).ReloadAsync(cacheAu);
            cacheRegistry.DidNotReceive().ReloadAsync(cacheNz);
        }
Пример #2
0
        public async Task RefreshAsync_not_null_success()
        {
            var cacheRegistry = Substitute.For <ICacheRegistry>();
            var siteCaches    = new SiteCaches(cacheRegistry);
            var rootAu        = new TestSite
            {
                Key      = Guid.NewGuid(),
                SiteName = "AU"
            };
            var rootNz = new TestSite
            {
                Key      = Guid.NewGuid(),
                SiteName = "NZ"
            };
            var cacheAu = siteCaches.Get(rootAu);
            var cacheNz = siteCaches.Get(rootNz);

            await siteCaches.RefreshAsync(rootAu).ConfigureAwait(false);

            await cacheRegistry.Received(1).ReloadAsync(cacheAu).ConfigureAwait(false);

            await cacheRegistry.DidNotReceive().ReloadAsync(cacheNz).ConfigureAwait(false);
        }