public void Password_CheckZipPassword_wi13664() { string[] passwords = { null, "Password!", TestUtilities.GenerateRandomPassword(), "_" }; string dirToZip = Path.Combine(TopLevelDir, "zipthis"); int subdirCount; int entries = TestUtilities.GenerateFilesOneLevelDeep (TestContext, "wi13664", dirToZip, null, out subdirCount); string[] filesToZip = Directory.GetFiles("zipthis", "*.*", SearchOption.AllDirectories); Assert.AreEqual <int>(filesToZip.Length, entries, "Incorrect number of entries in the directory."); for (int j = 0; j < passwords.Length; j++) { string zipFileToCreate = Path.Combine(TopLevelDir, String.Format("Password_CheckZipPassword_wi13664-{0}.zip", j)); // Create the zip archive using (ZipFile zip1 = new ZipFile()) { zip1.Password = passwords[j]; zip1.AddFiles(filesToZip, "", true); zip1.Save(zipFileToCreate); } var r = FileSystemZip.CheckZipPassword(zipFileToCreate, passwords[j]); Assert.IsTrue(r, "Bad password in round {0}", j); } }