예제 #1
0
        public async Task TestCacheIsSavedAndLoaded()
        {
            var caching = GetCaching();

            await CreateAndWrite(caching);

            Assert.IsNotNull(await CompositionManager.TryCreateRuntimeCompositionFromCache(caching));
        }
예제 #2
0
        public async Task TestCacheIsSavedAndLoaded()
        {
            var caching = GetCaching();
            var currentRuntimeComposition = await CreateAndWrite(caching);

            Assert.IsNotNull(currentRuntimeComposition);
            var cachedRuntimeComposition = await CompositionManager.TryCreateRuntimeCompositionFromCache(caching);

            Assert.AreEqual(currentRuntimeComposition, cachedRuntimeComposition);
        }
예제 #3
0
        public async Task TestCacheFileCorrupted()
        {
            var caching = GetCaching();

            await CreateAndWrite(caching);

            File.WriteAllText(caching.MefCacheFile, "corrupted");
            Assert.IsNull(await CompositionManager.TryCreateRuntimeCompositionFromCache(caching), "Cache was able to be constructed from corrupted cache");

            Assert.IsFalse(File.Exists(caching.MefCacheFile), "Cache was not deleted on corruption");
            Assert.IsFalse(File.Exists(caching.MefCacheControlFile), "Cache control was not deleted on corruption");
        }