Пример #1
0
        public void GetFileCache_FileCacheAlreadyRegistered_ReturnSameFileCache()
        {
            // Setup
            FileCacheManager manager = FileCacheManager.Instance;
            string           path    = TestHelper.GetScratchPadPath(nameof(GetFileCache_FileCacheAlreadyRegistered_ReturnSameFileCache));

            using (new DirectoryDisposeHelper(TestHelper.GetScratchPadPath(), nameof(GetFileCache_FileCacheAlreadyRegistered_ReturnSameFileCache)))
            {
                FileCache fileCache1 = manager.GetFileCache(path);

                // Call
                FileCache fileCache2 = manager.GetFileCache(path);

                // Assert
                Assert.AreSame(fileCache1, fileCache2);
            }
        }
Пример #2
0
        public void GivenFileCache_WhenUnsubscribingAndFileCacheNotUsed_ThenFileCacheDisposed()
        {
            // Given
            FileCacheManager manager = FileCacheManager.Instance;
            string           path    = TestHelper.GetScratchPadPath(nameof(GivenFileCache_WhenUnsubscribingAndFileCacheNotUsed_ThenFileCacheDisposed));

            using (new DirectoryDisposeHelper(TestHelper.GetScratchPadPath(), nameof(GivenFileCache_WhenUnsubscribingAndFileCacheNotUsed_ThenFileCacheDisposed)))
            {
                FileCache fileCache1 = manager.GetFileCache(path);

                // When
                manager.UnsubscribeFileCache(fileCache1);
                FileCache fileCache2 = manager.GetFileCache(path);

                // Then
                Assert.AreNotSame(fileCache1, fileCache2);
            }
        }