/// <summary> /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. /// </summary> /// <filterpriority>2</filterpriority> public void Dispose() { if (_zipDataCacheProvider != null) { _zipDataCacheProvider.Dispose(); } }
public void MultiThreadReadWriteTest() { var dataCacheProvider = new ZipDataCacheProvider(TestGlobals.DataProvider, cacheTimer: 0.1); Parallel.For(0, 100, (i) => { var data = new byte[300]; _random.NextBytes(data); ReadAndWrite(dataCacheProvider, data); }); dataCacheProvider.Dispose(); }
public void StoreFailsCorruptedFile() { var dataCacheProvider = new ZipDataCacheProvider(TestGlobals.DataProvider, cacheTimer: 0.1); var tempZipFileEntry = Path.GetTempFileName().Replace(".tmp", ".zip", StringComparison.InvariantCulture); var data = new byte[300]; _random.NextBytes(data); File.WriteAllText(tempZipFileEntry, "corrupted zip"); Assert.Throws <InvalidOperationException>(() => dataCacheProvider.Store(tempZipFileEntry + "#testEntry.csv", data)); dataCacheProvider.Dispose(); }