public async Task OverallListUpdatedWhenRenamed() { // want to make sure this works no matter when list cache is loaded for (int i = 0; i < 3; ++i) { var inner = new TestEnvironmentCoordinator(); var outer = new CachingConfigRepository <RenderingEnvironment>(inner, NewCache()); if (i == 0) { await outer.List(); } var env = NewEnv(); await outer.Update(env, env.Name, null); if (i == 1) { await outer.List(); } var renamedEnv = NewEnv(); await outer.Update(renamedEnv, renamedEnv.Name, env.Name); var result = await outer.List(); Assert.Equal(renamedEnv.Name, result.Single()); } }
public async Task EnvironmentListUncachedWhenRemoved() { // want to make sure this works no matter where the cache is first loaded for (int i = 0; i < 3; ++i) { var inner = new TestEnvironmentCoordinator(); var outer = new CachingConfigRepository <RenderingEnvironment>(inner, NewCache()); if (i == 0) { await outer.List(); } var env = NewEnv(); await outer.Update(env, env.Name, null); if (i == 1) { await outer.List(); } await outer.Remove(env.Name); Assert.Empty(await outer.List()); } }
public async Task EnvironmentUncachedWhenRemoved() { var inner = new TestEnvironmentCoordinator(); var outer = new CachingConfigRepository <RenderingEnvironment>(inner, NewCache()); var env = NewEnv(); await outer.Update(env, env.Name, null); await outer.Remove(env.Name); Assert.Null(await outer.Get(env.Name)); }
public async Task CachesToListOnGet() { var inner = new TestEnvironmentCoordinator(); var outer = new CachingConfigRepository <RenderingEnvironment>(inner, NewCache()); var env = NewEnv(); await outer.List(); // load list cache // load inner then get it await inner.Update(env, env.Name, null); await outer.Get(env.Name); var result = await outer.List(); Assert.Equal(env.Name, result.Single()); }
public async Task OverallListUpdatedWhenAdded() { var inner = new TestEnvironmentCoordinator(); var outer = new CachingConfigRepository <RenderingEnvironment>(inner, NewCache()); // load list cache await outer.List(); var env = NewEnv(); await outer.Update(env, env.Name, null); // remove from inner await inner.Remove(env.Name); // make sure list is cached var result = await outer.List(); Assert.Equal(env.Name, result.Single()); }
public async Task CachesOnGet() { var inner = new TestEnvironmentCoordinator(); var outer = new CachingConfigRepository <RenderingEnvironment>(inner, NewCache()); var env = NewEnv(); // load cache await inner.Update(env, env.Name, null); await outer.Get(env.Name); // remove real value await inner.Remove(env.Name); // check it's still cached var result = await outer.Get(env.Name); Assert.Equal(env, result); }