Пример #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");
        }