public void GenerateFullManifest() { ManifestGenerator generator = new ManifestGenerator(); IntegrationRequest request = new IntegrationRequest(BuildCondition.ForceBuild, "Somewhere", null); IntegrationSummary summary = new IntegrationSummary(IntegrationStatus.Success, "A Label", "Another Label", new DateTime(2009, 1, 1)); IntegrationResult result = new IntegrationResult("Test project", "Working directory", "Artifact directory", request, summary); Modification modification1 = GenerateModification("first file", "Add"); Modification modification2 = GenerateModification("second file", "Modify"); result.Modifications = new Modification[] { modification1, modification2 }; List<string> files = new List<string>(); files.Add("first file"); XmlDocument manifest = generator.Generate(result, files.ToArray()); Assert.IsNotNull(manifest); string actualManifest = manifest.OuterXml; string expectedManifest = "<manifest>" + "<header project=\"Test project\" label=\"A Label\" build=\"ForceBuild\" status=\"Unknown\">" + "<modification user=\"johnDoe\" changeNumber=\"1\" time=\"2009-01-01T00:00:00\">" + "<comment>A comment</comment>" + "<file name=\"first file\" type=\"Add\" />" + "<file name=\"second file\" type=\"Modify\" />" + "</modification>" + "</header>" + "<file name=\"first file\" />" + "</manifest>"; Assert.AreEqual(expectedManifest, actualManifest); }
/// <summary> /// Generate the manifest and add it to the package. /// </summary> /// <param name="result"></param> /// <param name="packagedFiles"></param> /// <param name="zipStream"></param> private void AddManifest(IIntegrationResult result, List <string> packagedFiles, ZipOutputStream zipStream) { // Generate the manifest XmlDocument manifest = ManifestGenerator.Generate(result, packagedFiles.ToArray()); // And add the manifest to the package ZipEntry entry = new ZipEntry("manifest.xml"); zipStream.PutNextEntry(entry); manifest.Save(zipStream); zipStream.CloseEntry(); }
public void CheckAllProperties() { PackagePublisher publisher = new PackagePublisher(); publisher.AlwaysPackage = true; Assert.AreEqual(true, publisher.AlwaysPackage); publisher.CompressionLevel = 9; Assert.AreEqual(9, publisher.CompressionLevel); publisher.Flatten = true; Assert.AreEqual(true, publisher.Flatten); ManifestGenerator generator = new ManifestGenerator(); publisher.ManifestGenerator = generator; Assert.AreSame(generator, publisher.ManifestGenerator); publisher.PackageName = "Package name"; Assert.AreEqual("Package name", publisher.PackageName); publisher.PackageList = new IPackageItem[] { new PackageFile() }; Assert.AreEqual(1, publisher.PackageList.Length); }
public void CheckAllProperties() { PackagePublisher publisher = new PackagePublisher(); publisher.AlwaysPackage = true; Assert.AreEqual(true, publisher.AlwaysPackage); publisher.BaseDirectory = "The BASE!"; Assert.AreEqual("The BASE!", publisher.BaseDirectory); publisher.CompressionLevel = 9; Assert.AreEqual(9, publisher.CompressionLevel); publisher.Flatten = true; Assert.AreEqual(true, publisher.Flatten); ManifestGenerator generator = new ManifestGenerator(); publisher.ManifestGenerator = generator; Assert.AreSame(generator, publisher.ManifestGenerator); publisher.PackageName = "Package name"; Assert.AreEqual("Package name", publisher.PackageName); publisher.Files = new string[] { "filename" }; Assert.AreEqual(1, publisher.Files.Length); Assert.AreEqual("filename", publisher.Files[0]); }