예제 #1
0
        public void WriteTest()
        {
            var entryName = "testEntry.csv";
            var filePath  = Path.GetTempFileName().Replace(".tmp", ".zip", StringComparison.InvariantCulture);
            var key       = filePath + "#" + entryName;

            var random = new Random();
            var data   = new byte[10];

            random.NextBytes(data);

            // Write this data to our entry in the temp zip
            DataCacheProvider.Store(key, data);

            // Verify it exists
            Assert.IsTrue(File.Exists(filePath));

            // Open the file are verify we have the expected results
            var zip = new ZipFile(filePath);

            Assert.AreEqual(1, zip.Count);
            Assert.IsNotNull(zip.GetEntry(entryName));

            zip.DisposeSafely();
        }
예제 #2
0
        public void OverrideEntry()
        {
            var entryName = "testEntry.csv";
            var filePath  = Path.GetTempFileName().Replace(".tmp", ".zip", StringComparison.InvariantCulture);
            var key       = filePath + "#" + entryName;

            var random = new Random();
            var data   = new byte[10];

            random.NextBytes(data);

            // Write this data to our entry in the temp zip
            DataCacheProvider.Store(key, data);

            // Verify it exists
            Assert.IsTrue(File.Exists(filePath));

            random = new Random();
            data   = new byte[10];
            random.NextBytes(data);

            // Write this data to our entry in the temp zip
            DataCacheProvider.Store(key, data);
        }