/// <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();
     }
 }
Exemplo n.º 2
0
        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();
        }
Exemplo n.º 3
0
        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();
        }