Inheritance: ITransformer
示例#1
0
        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);
        }
示例#2
0
        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);
        }