Example #1
0
        public void TestValidWriterGeneration()
        {
            Dictionary <ArchiveFactory.Type, Type> validIterators = new Dictionary <ArchiveFactory.Type, Type>()
            {
                { ArchiveFactory.Type.Tar, typeof(SharpZipTarArchiveWriter) },
                { ArchiveFactory.Type.Zip, typeof(DotNetZipZipWriter) }
            };

            foreach (KeyValuePair <ArchiveFactory.Type, Type> pair in validIterators)
            {
                using (MemoryStream ms = new MemoryStream())
                {
                    ArchiveWriter providedStream = ArchiveFactory.Writer(pair.Key, ms);
                    Assert.AreEqual(providedStream.GetType(), pair.Value);
                }
            }
        }
Example #2
0
        public void CreateAnArchiveAndRereadWhenPossible()
        {
            string tempPath = CreateTempFolder();

            string tarFileName = Path.Combine(tempPath, Path.GetRandomFileName());

            WriteAnArchive(tarFileName);

            if (reader != null)
            {
                RereadAnArchiveAndTest(tarFileName);
            }
            else
            {
                Trace.WriteLine(String.Format("A reader for the writer class {0} was not found so the contents are unvalidated by this test", writer.GetType()));
            }

            Directory.Delete(tempPath, true);
        }