Ejemplo n.º 1
0
        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());
            }
        }
Ejemplo n.º 2
0
        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());
            }
        }
Ejemplo n.º 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());
        }
Ejemplo n.º 4
0
        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());
        }