public void ForXmlFile_should_throw_exception_if_no_paths_specified() { AssertExceptionThrown .OfType <ArgumentNullException>() .WithMessage("Value cannot be null.\r\nParameter name: possiblePaths") .WhenExecuting(() => XmlTransformer.ForXmlFile()); }
public void TransformedByFile_should_return_XmlTransformer_when_one_or_more_paths_specified() { ForTest.Scenarios ( new[] { "path1" }, new[] { "path1", "path2" } ) .TestEach(scenario => AssertExceptionNotThrown.WhenExecuting(() => { var transformer = XmlTransformer.ForXmlFile(scenario); Assert.AreSame(transformer, transformer.TransformedByFile(scenario)); })); }
public void Transform_should_work_with_no_transform_files() { TransformResults results = XmlTransformer .ForXmlFile("SparkyTestHelpers.Xml.UnitTests.dll.config") .Transform(); Console.WriteLine(results.Log); Assert.IsTrue(results.Successful); Assert.IsNull(results.ErrorMessage); StringAssert.Contains(results.TransformedXml, "Original Value1"); Assert.IsInstanceOfType(results.XDocument, typeof(XDocument)); }
public void Transform_should_work_with_single_level_transformation() { TransformResults results = XmlTransformer .ForXmlFile("SparkyTestHelpers.Xml.UnitTests.dll.config") .TransformedByFile(RelativePaths("app.transform1.config")) .Transform(); Console.WriteLine(results.Log); Assert.IsTrue(results.Successful); Assert.IsNull(results.ErrorMessage); StringAssert.Contains(results.TransformedXml, "Value1 updated by transform1"); StringAssert.Contains(results.TransformedXml, "transform1 applied"); Assert.IsInstanceOfType(results.XDocument, typeof(XDocument)); }
public void Transform_should_cache_TransformResults() { var transformer = XmlTransformer.ForXmlFile("base.config") .TransformedByFile("transform1.config", "transform2.config"); TransformResults results1 = transformer.Transform(); Assert.IsFalse(transformer.GotTransformResultsFromCache); TransformResults results2 = transformer.Transform(); Assert.AreSame(results1, results2); Assert.IsTrue(transformer.GotTransformResultsFromCache); }
public void Transform_XElement_into_XMlTester_should_work() { TransformResults results = XmlTransformer .ForXmlFile("SparkyTestHelpers.Xml.UnitTests.dll.config") .TransformedByFile(RelativePaths("app.transform1.config")) .Transform(); Assert.IsTrue(results.Successful); XmlTester xmlTester = new XmlTester(results.XDocument); Assert.IsInstanceOfType(xmlTester, typeof(XmlTester)); xmlTester.AssertAppSettingsValue("Key1", "Value1 updated by transform1"); }