public void AppPackage_ExtractTo() { string tempPath = GetTempFileName(); string tempDir = Helper.AddTrailingSlash(Path.GetTempPath()); AppPackage package = null; try { package = AppPackage.Create(tempPath, AppRef.Parse("appref://myapps/mypackage.zip?version=1.2.3.4"), @" LaunchType = Test.MyType:MyAssembly.dll; LaunchMethod = Foo; LaunchArgs = Bar; "); package.AddFile("File1.txt", Helper.ToUTF8("Hello World! #1\r\n")); package.AddFile("File2.txt", Helper.ToUTF8("Hello World! #2\r\n")); package.Close(); package = null; package = AppPackage.Open(tempPath); package.ExtractTo(tempDir); package.Close(); package = null; Assert.IsTrue(File.Exists(tempDir + "Package.ini")); Assert.IsTrue(File.Exists(tempDir + "File1.txt")); Assert.IsTrue(File.Exists(tempDir + "File2.txt")); using (var reader = new StreamReader(tempDir + "File1.txt")) { Assert.AreEqual("Hello World! #1", reader.ReadLine()); } using (var reader = new StreamReader(tempDir + "File2.txt")) { Assert.AreEqual("Hello World! #2", reader.ReadLine()); } } finally { if (package != null) { package.Close(); } Delete(tempPath); } }