public Transform ( string inputFilePath, string outputFilePath, |
||
inputFilePath | string | |
outputFilePath | string | |
settings | ||
return | void |
public void ApplicatioSettings() { var xslt = Path.Combine(Helper.GetDataPath(), "ApplicationSettings.xslt"); var output = Path.Combine(Helper.GetDataPath(), "ApplicationSettings.xml"); if (File.Exists(output)) File.Delete(output); var expected = GetKeyValueCollection(); var transformer = new XsltTransformer(); transformer.Transform(xslt, output, expected); var actual = GetApplicationSettingsFromFile(output); Assert.AreEqual(expected.Count, actual.Count); }
public void SimpleTransformTest() { var xslt = Path.Combine(Helper.GetDataPath(), "Sample.xslt"); var output = Path.Combine(Helper.GetDataPath(), "Sample.xml"); if (File.Exists(output)) File.Delete(output); var transformer = new XsltTransformer(); transformer.Transform(xslt, output, GetKeyValueCollection()); XmlDocument doc = new XmlDocument(); doc.Load(output); var nameNodes = doc.SelectNodes("configuration/appSettings/add[@key = 'Name' and @value = 'Value']"); var emailNodes = doc.SelectNodes("configuration/appSettings/add[@key = 'Email' and @value = '*****@*****.**']"); var companyNodes = doc.SelectNodes("configuration/appSettings/add[@key = 'Company' and @value = 'IBM']"); Assert.AreEqual(nameNodes.Count, 1); Assert.AreEqual(emailNodes.Count, 1); Assert.AreEqual(companyNodes.Count, 1); }