public static void ExtractToFileTest()
        {
            using (ZipArchive archive = ZipFile.Open(zfile("normal.zip"), ZipArchiveMode.Read))
            {
                String          file = StreamHelpers.GetTmpFileName();
                ZipArchiveEntry e    = archive.GetEntry("first.txt");

                //extract when there is nothing there
                e.ExtractToFile(file);

                using (Stream fs = File.Open(file, FileMode.Open), es = e.Open())
                {
                    StreamsEqual(fs, es);
                }

                Assert.Throws <IOException>(() => e.ExtractToFile(file, false));

                //truncate file
                using (Stream fs = File.Open(file, FileMode.Truncate)) { }

                //now use overwrite mode
                e.ExtractToFile(file, true);

                using (Stream fs = File.Open(file, FileMode.Open), es = e.Open())
                {
                    StreamsEqual(fs, es);
                }
            }
        }
        private static async Task TestCreateDirectory(String folderName, Boolean testWithBaseDir)
        {
            String noBaseDir = StreamHelpers.GetTmpFileName();

            ZipFile.CreateFromDirectory(folderName, noBaseDir);

            await IsZipSameAsDirAsync(noBaseDir, folderName, ZipArchiveMode.Read, true, true);

            if (testWithBaseDir)
            {
                String withBaseDir = StreamHelpers.GetTmpFileName();
                ZipFile.CreateFromDirectory(folderName, withBaseDir, CompressionLevel.Optimal, true);
                SameExceptForBaseDir(noBaseDir, withBaseDir, folderName);
            }
        }