public void LoadConfiguration()
        {
            CruiseControlConfigSectionHandler handler = new CruiseControlConfigSectionHandler();

            string  xml     = "<cruisecontrol/>";
            XmlNode xmlNode = XmlUtil.CreateDocumentElement(xml);

            IConfiguration config = handler.Create(null, null, xmlNode) as IConfiguration;
        }
        public void ShouldSaveEmptyFileIfNoModificationsSpecified()
        {
            mockIO.Setup(fileSystem => fileSystem.Save(System.IO.Path.Combine(@"artifactDir", "output.xml"), It.IsAny <string>())).
            Callback <string, string>((file, content) => {
                XmlUtil.VerifyXmlIsWellFormed(content);
                XmlElement element = XmlUtil.CreateDocumentElement(content);
                Assert.AreEqual(0, element.ChildNodes.Count);
            }).Verifiable();

            IntegrationResult result = IntegrationResultMother.CreateSuccessful();

            result.ArtifactDirectory = "artifactDir";
            task.Filename            = "output.xml";
            task.Run(result);
        }
        public void ShouldRebaseDirectoryRelativeToArtifactDir()
        {
            mockIO.Setup(fileSystem => fileSystem.Save(System.IO.Path.Combine("artifactDir", "relativePath", "modifications.xml"), It.IsAny <string>())).
            Callback <string, string>((file, content) => {
                XmlUtil.VerifyXmlIsWellFormed(content);
                XmlElement element = XmlUtil.CreateDocumentElement(content);
                Assert.AreEqual(0, element.ChildNodes.Count);
            }).Verifiable();

            IntegrationResult result = IntegrationResultMother.CreateSuccessful();

            result.ArtifactDirectory = "artifactDir";
            task.OutputPath          = "relativePath";
            task.Run(result);
        }
        public void ShouldRebaseDirectoryRelativeToArtifactDirWithBuildTimeAppended()
        {
            IntegrationResult result      = IntegrationResultMother.CreateSuccessful();
            string            newFileName = string.Format(System.Globalization.CultureInfo.CurrentCulture, System.IO.Path.Combine("artifactDir", "relativePath", "modifications_{0}.xml"), result.StartTime.ToString("yyyyMMddHHmmssfff"));

            mockIO.Setup(fileSystem => fileSystem.Save(newFileName, It.IsAny <string>())).
            Callback <string, string>((file, content) => {
                XmlUtil.VerifyXmlIsWellFormed(content);
                XmlElement element = XmlUtil.CreateDocumentElement(content);
                Assert.AreEqual(0, element.ChildNodes.Count);
            }).Verifiable();

            result.ArtifactDirectory = "artifactDir";
            task.OutputPath          = "relativePath";
            task.AppendTimeStamp     = true;

            task.Run(result);
        }
        public void ShouldWriteOutModificationsToFileAsXml()
        {
            mockIO.Setup(fileSystem => fileSystem.Save(System.IO.Path.Combine(@"artifactDir", "modifications.xml"), It.IsAny <string>())).
            Callback <string, string>((file, content) => {
                XmlUtil.VerifyXmlIsWellFormed(content);
                XmlElement element = XmlUtil.CreateDocumentElement(content);
                Assert.AreEqual(2, element.ChildNodes.Count);
            }).Verifiable();

            IntegrationResult result = IntegrationResultMother.CreateSuccessful();

            result.ArtifactDirectory = "artifactDir";
            result.Modifications     = new Modification[]
            {
                ModificationMother.CreateModification("foo.txt", @"c\src"),
                ModificationMother.CreateModification("bar.txt", @"c\src")
            };
            task.Run(result);
        }
Exemple #6
0
        public void ShouldSaveEmptyFileIfNoModificationsSpecifiedWithBuildTimeAppended()
        {
            IntegrationResult result      = IntegrationResultMother.CreateSuccessful();
            string            newFileName = string.Format(System.Globalization.CultureInfo.CurrentCulture, "artifactDir\\output_{0}.xml", result.StartTime.ToString("yyyyMMddHHmmssfff"));

            mockIO.Setup(fileSystem => fileSystem.Save(newFileName, It.IsAny <string>())).
            Callback <string, string>((file, content) => {
                XmlUtil.VerifyXmlIsWellFormed(content);
                XmlElement element = XmlUtil.CreateDocumentElement(content);
                Assert.AreEqual(0, element.ChildNodes.Count);
            }).Verifiable();

            result.ArtifactDirectory = "artifactDir";
            task.Filename            = "output.xml";
            task.AppendTimeStamp     = true;


            task.Run(result);
        }
        public void ShouldWriteOutModificationsToFileAsXmlWithBuildTimeAppended()
        {
            IntegrationResult result      = IntegrationResultMother.CreateSuccessful();
            string            newFileName = string.Format(System.Globalization.CultureInfo.CurrentCulture, System.IO.Path.Combine("artifactDir", "modifications_{0}.xml"), result.StartTime.ToString("yyyyMMddHHmmssfff"));

            mockIO.Setup(fileSystem => fileSystem.Save(newFileName, It.IsAny <string>())).
            Callback <string, string>((file, content) => {
                XmlUtil.VerifyXmlIsWellFormed(content);
                XmlElement element = XmlUtil.CreateDocumentElement(content);
                Assert.AreEqual(2, element.ChildNodes.Count);
            }).Verifiable();

            result.ArtifactDirectory = "artifactDir";
            result.Modifications     = new Modification[]
            {
                ModificationMother.CreateModification("foo.txt", @"c\src"),
                ModificationMother.CreateModification("bar.txt", @"c\src")
            };
            task.AppendTimeStamp = true;
            task.Run(result);
        }
Exemple #8
0
        public override bool Eval(object val)
        {
            XmlElement element = XmlUtil.CreateDocumentElement(val.ToString());

            return(element.ChildNodes.Count == count);
        }