コード例 #1
0
        public void IncludeManifestInPackage()
        {
            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 };
            result.Status = IntegrationStatus.Success;
            result.ArtifactDirectory = Path.GetTempPath();

            XmlDocument manifest = new XmlDocument();
            manifest.AppendChild(manifest.CreateElement("manifest"));
            DynamicMock generatorMock = new DynamicMock(typeof(IManifestGenerator));
            List<string> files = new List<string>();
            files.Add(dataFilePath);
            generatorMock.ExpectAndReturn("Generate", manifest, result, files.ToArray());

            string packageLocation = Path.Combine(Path.GetTempPath(), "Test Package-1");
            string packageName = packageLocation + ".zip";
            if (File.Exists(packageName)) File.Delete(packageName);
            PackagePublisher publisher = new PackagePublisher();
            publisher.PackageName = packageLocation;
            publisher.ManifestGenerator = generatorMock.MockInstance as IManifestGenerator;
            publisher.PackageList = new IPackageItem[] { 
                new PackageFile(dataFilePath) 
            };
            publisher.Run(result);
            Assert.IsTrue(File.Exists(packageName), "Package not generated");
            Assert.IsTrue(
                File.Exists(Path.Combine(Path.GetTempPath(), Path.Combine("A Label", "Test project-packages.xml"))),
                "Project package list not generated");
            generatorMock.Verify();
        }
コード例 #2
0
        public void RunForDirectoryWildCard()
        {
            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 };
            result.Status = IntegrationStatus.Success;
            result.ArtifactDirectory = Path.GetTempPath();

            string packageLocation = Path.Combine(Path.GetTempPath(), "Test Package-1");
            string packageName = packageLocation + ".zip";
            if (File.Exists(packageName)) File.Delete(packageName);
            PackagePublisher publisher = new PackagePublisher();
            publisher.PackageName = packageLocation;
            publisher.PackageList = new IPackageItem[] { 
                new PackageFile(Path.Combine(Path.GetTempPath(), "**\\datafile.txt"))
            };
            publisher.Run(result);
            Assert.IsTrue(File.Exists(packageName), "Package not generated");
            Assert.IsTrue(
                File.Exists(Path.Combine(Path.GetTempPath(), Path.Combine("A Label", "Test project-packages.xml"))),
                "Project package list not generated");
        }