Пример #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());
            }
        }
Пример #2
0
        public async Task OriginalEnvironmentUncachedWhenRenamed()
        {
            var inner = new TestEnvironmentCoordinator();
            var outer = new CachingConfigRepository <RenderingEnvironment>(inner, NewCache());

            var env = NewEnv();
            await outer.Update(env, env.Name, null);

            var renamedEnv = NewEnv();
            await outer.Update(renamedEnv, renamedEnv.Name, env.Name);

            var result = await outer.Get(env.Name);

            Assert.Null(result);
        }
Пример #3
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());
            }
        }
Пример #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());
        }