示例#1
0
        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);
        }
示例#2
0
        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));
        }
示例#3
0
        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());
        }