public void LoadStatistics() { testDir.CreateDirectory().CreateTextFile(StatisticsPublisher.XmlFileName, "<statistics />"); XmlDocument statisticsDoc = new XmlDocument(); statisticsDoc.LoadXml(StatisticsPublisher.LoadStatistics(testDir.ToString())); XPathNavigator navigator = statisticsDoc.CreateNavigator(); XPathNodeIterator nodeIterator = navigator.Select("//timestamp/@day"); nodeIterator.MoveNext(); int day = Convert.ToInt32(nodeIterator.Current.Value); Assert.AreEqual(DateTime.Now.Day, day); nodeIterator = navigator.Select("//timestamp/@month"); nodeIterator.MoveNext(); string month = nodeIterator.Current.Value; Assert.AreEqual(DateTime.Now.ToString("MMM"), month); nodeIterator = navigator.Select("//timestamp/@year"); nodeIterator.MoveNext(); int year = Convert.ToInt32(nodeIterator.Current.Value); Assert.AreEqual(DateTime.Now.Year, year); }
private static void CountNodes(string artifactFolder, string xpath, int count) { XmlDocument doc = new XmlDocument(); //doc.Load(statsFile2); doc.LoadXml(StatisticsPublisher.LoadStatistics(artifactFolder)); XmlNodeList node = doc.SelectNodes(xpath); Assert.AreEqual(count, node.Count); }
private IntegrationResult SimulateBuild(int buildLabel) { StatisticsPublisher publisher = new StatisticsPublisher(); IntegrationResult result = IntegrationResultMother.CreateSuccessful(buildLabel.ToString()); result.ArtifactDirectory = testDir.ToString(); publisher.Run(result); return(result); }
private IntegrationResult simulateBuild(int buildLabel) { StatisticsPublisher publisher = new StatisticsPublisher(); IntegrationResult result = IntegrationResultMother.CreateSuccessful(buildLabel.ToString()); result.LastSuccessfulIntegrationLabel = (buildLabel - 1).ToString(); result.ArtifactDirectory = tmpdir.FullName; publisher.Run(result); return(result); }