public void ShouldRunBuildIfThereAreModifications()
        {
            Modification modification = ModificationMother.CreateModification("foo", DateTime.Now.AddSeconds(-2));

            result.Modifications = new Modification[] { modification };
            Assert.IsTrue(result.ShouldRunBuild());
        }
        public void ShouldWriteOutModificationsToFileAsXml()
        {
            mockIO.Expect("Save", @"artifactDir\modifications.xml", new IsValidXml().And(new HasChildElements(2)));

            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);
        }
Example #3
0
        public void SetUp()
        {
            writerTask = new ModificationWriterTask();
            readerTask = new ModificationReaderTask();

            writerTask.AppendTimeStamp = true;

            ClearExistingModificationFiles();

            modifications = new Modification[]
            {
                ModificationMother.CreateModification("foo.txt", @"c\src"),
                ModificationMother.CreateModification("bar.txt", @"c\src")
            };
        }
Example #4
0
 private static void AddModifications(IntegrationResult result)
 {
     result.Modifications    = new Modification[3];
     result.Modifications[0] = ModificationMother.CreateModification("fileName", "folderName",
                                                                     new DateTime(2009, 1, 1), "userName",
                                                                     "comment", "10", "email@address",
                                                                     "http://url");
     result.Modifications[1] = ModificationMother.CreateModification("fileName", "folderName",
                                                                     new DateTime(2009, 1, 3), "userName",
                                                                     "comment", "30", "email@address",
                                                                     "http://url");
     result.Modifications[2] = ModificationMother.CreateModification("fileName", "folderName",
                                                                     new DateTime(2009, 1, 2), "userName",
                                                                     "comment", "20", "email@address",
                                                                     "http://url");
 }
        public void ShouldWriteOutModificationsToFileAsXmlWithBuildTimeAppended()
        {
            IntegrationResult result      = IntegrationResultMother.CreateSuccessful();
            string            newFileName = string.Format(System.Globalization.CultureInfo.CurrentCulture, "artifactDir\\modifications_{0}.xml", result.StartTime.ToString("yyyyMMddHHmmssfff"));

            mockIO.Expect("Save", newFileName, new IsValidXml().And(new HasChildElements(2)));

            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);
        }
        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);
        }
        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);
        }