Skip to content

Instantly share code, notes, and snippets.

@dvhthomas
Created November 21, 2009 00:22
Show Gist options
  • Save dvhthomas/239909 to your computer and use it in GitHub Desktop.
Save dvhthomas/239909 to your computer and use it in GitHub Desktop.
Testing the 7zip implementation
[Test]
public void Compressing_file_in_non_working_directory_zips_the_right_files()
{
const string zipFile = "archive.7z";
const string fileToCompress = "sample.jpg";
DirectoryInfo directoryInfo = new DirectoryInfo(@"..\..\..\..\");
Console.Write(directoryInfo.FullName);
Assert.IsTrue(directoryInfo.Exists);
FileInfo zipTarget = new FileInfo(Path.Combine(directoryInfo.FullName, zipFile));
IFileZipUtility zipper = new FileZipUtility(new SevenZip());
zipper.GenerateZipFile(zipTarget.FullName, new FileInfo(Path.Combine(directoryInfo.FullName, fileToCompress)));
var exists = zipTarget.Exists;
Assert.IsTrue(exists);
zipTarget.Delete();
}
/// <summary>
/// Setup that happens before any test run in this fixture
/// </summary>
[TestFixtureSetUp]
public void SetupFixture()
{
ILogFactory logFactory = new Logging.NLog.NLogFactory();
Log.InitializeLogFactory(logFactory);
this._utility = new FileZipUtility(new SevenZip(_sevenZipPath));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment