public void ShouldFailWhenInputInvalid() { string input = @"<This is some invalid xml"; string xslfile = TempFileUtil.CreateTempXmlFile(TestFolder, "samplestylesheet.xsl", TestData.StyleSheetContents); Assert.That(delegate { new XslTransformer().Transform(input, xslfile, null); }, Throws.TypeOf <CruiseControlException>()); }
public void LoadConfiguration_BadXml() { FileInfo configFile = new FileInfo(TempFileUtil.CreateTempXmlFile(TempFileUtil.CreateTempDir(this), "loadernet.config" , "<test><a><b/></test>")); Assert.That(delegate { fileLoader.LoadConfiguration(configFile); }, Throws.TypeOf <ConfigurationException>()); }
public void ShouldFailOnFailedProcessResult() { TempFileUtil.CreateTempXmlFile(string.Format(logfile, task.LogFileId), "<output/>"); ExpectToExecuteAndReturn(FailedProcessResult()); task.Run(result); Assert.AreEqual(2, result.TaskResults.Count); Assert.AreEqual("<output/>" + ProcessResultOutput, result.TaskOutput); Assert.IsTrue(result.Failed); }
public void ShouldAutomaticallyMergeTheBuildOutputFile() { TempFileUtil.CreateTempXmlFile(string.Format(logfile, task.LogFileId), "<output/>"); ExpectToExecuteAndReturn(SuccessfulProcessResult()); task.Run(result); Assert.AreEqual(2, result.TaskResults.Count); Assert.That(result.TaskOutput, Is.EqualTo("<output/>")); Assert.IsTrue(result.Succeeded); }
public void LoadConfigurationFile() { string xml = "<cruisecontrol />"; FileInfo configFile = new FileInfo(TempFileUtil.CreateTempXmlFile(TempFileUtil.CreateTempDir(this), "loadernet.config", xml)); XmlDocument config = fileLoader.LoadConfiguration(configFile); Assert.IsNotNull(config); Assert.AreEqual(xml, config.OuterXml); }
public void ShouldFailOnFailedProcessResult() { AddDefaultAssemblyToCheck(task); TempFileUtil.CreateTempXmlFile(logfile, "<output/>"); ExpectToExecuteAndReturn(FailedProcessResult()); task.Run(result); Assert.AreEqual(1, result.TaskResults.Count); Assert.That(result.TaskOutput, Is.EqualTo(ProcessResultOutput)); Assert.IsTrue(result.Failed); }
public void ShouldAutomaticallyMergeTheBuildOutputFile() { AddDefaultAssemblyToCheck(task); TempFileUtil.CreateTempXmlFile(logfile, "<output/>"); ExpectToExecuteAndReturn(SuccessfulProcessResult()); task.Run(result); Assert.AreEqual(1, result.TaskResults.Count); Assert.That(result.TaskOutput, Is.Empty); Assert.IsTrue(result.Succeeded); }
public void ShouldTransformData() { string input = TestData.LogFileContents; string xslfile = TempFileUtil.CreateTempXmlFile(TestFolder, "samplestylesheet.xsl", TestData.StyleSheetContents); string output = new XslTransformer().Transform(input, xslfile, null); Assert.IsNotNull(output); Assert.IsTrue(!String.Empty.Equals(output), "Transform returned no data"); }
public void TestCreateTempXmlDoc() { TempFileUtil.CreateTempDir(TempDir); string path = TempFileUtil.CreateTempXmlFile(TempDir, "foobar.xml", "<test />"); Assert.IsTrue(File.Exists(path)); XmlDocument doc = new XmlDocument(); doc.Load(path); }
public void ShouldPassThroughXSLTArgs() { string input = TestData.LogFileContents; string xslfile = TempFileUtil.CreateTempXmlFile(TestFolder, "samplestylesheet.xsl", TestData.StyleSheetContentsWithParam); Hashtable xsltArgs = new Hashtable(); xsltArgs["myParam"] = "myValue"; string output = new XslTransformer().Transform(input, xslfile, xsltArgs); Assert.IsTrue(output.IndexOf("myValue") > 0); }
public void HandleFileChanged() { tempFile = TempFileUtil.CreateTempXmlFile("FileChangedWatcherTest", "foo.xml", "<derek><zoolander/></derek>"); using (FileChangedWatcher watcher = new FileChangedWatcher(tempFile)) { watcher.OnFileChanged += new FileSystemEventHandler(FileChanged); UpdateFile("<rob><schneider/></rob>"); Assert.AreEqual(1, filechangedCount); UpdateFile("<joseph><conrad/></joseph"); Assert.AreEqual(2, filechangedCount); } }
public void HandleFileMove() { tempFile = TempFileUtil.GetTempFilePath("FileChangedWatcherTest", "foo.xml"); using (FileChangedWatcher watcher = new FileChangedWatcher(tempFile)) { watcher.OnFileChanged += new FileSystemEventHandler(FileChanged); string file = TempFileUtil.CreateTempXmlFile("FileChangedWatcherTest", "bar.xml", "<adam><sandler /></adam>"); new FileInfo(file).MoveTo(tempFile); Assert.IsTrue(monitor.WaitOne(5000, false)); monitor.Reset(); Assert.AreEqual(1, filechangedCount); } }
private string CreateTemporaryConfigurationFile() { string configXml = @"<configuration> <system.runtime.remoting> <application> <channels> <channel ref=""tcp"" port=""35354"" name=""ccnet""> <serverProviders> <formatter ref=""binary"" typeFilterLevel=""Full"" /> </serverProviders> </channel> <channel ref=""http"" port=""35355"" name=""ccnet2""> <serverProviders> <formatter ref=""binary"" typeFilterLevel=""Full"" /> </serverProviders> </channel> </channels> </application> </system.runtime.remoting> </configuration>"; TempFileUtil.CreateTempDir("RemoteCruiseServerTest"); return(TempFileUtil.CreateTempXmlFile("RemoteCruiseServerTest", "remote.config", configXml)); }
private void UpdateFile(string text) { TempFileUtil.CreateTempXmlFile("FileChangedWatcherTest", "foo.xml", text); Assert.IsTrue(monitor.WaitOne(10000, false)); monitor.Reset(); }
// public static string CreateConfigFile() // { // return CreateConfigFile(ConfigurationMother.Content()); // } public static string CreateConfigFile(string content) { TempFileUtil.CreateTempDir(TEMP_DIR, false); return(TempFileUtil.CreateTempXmlFile(TEMP_DIR, "testConfig.xml", content)); }
public static string CreateBuildFile(string content) { TempFileUtil.CreateTempDir(TEMP_DIR); return(TempFileUtil.CreateTempXmlFile(TEMP_DIR, NANT_TEST_BUILDFILE, content)); }