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); }
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); }