Пример #1
0
        public void XmlManagerProcessConfigXmlSetting_InvalidSelector()
        {
            string testConfigFile    = File.ReadAllText(Path.Combine(TestContext.CurrentContext.TestDirectory, "TestFiles", "Config.json"));
            string testAppConfigFile = File.ReadAllText(Path.Combine(TestContext.CurrentContext.TestDirectory, "TestFiles", "app.config"));

            XmlFileManager manager = new XmlFileManager();
            var            result  = manager.Process(testAppConfigFile, new XmlSetting("test", "/configuration/nlog:nlog/nlog:rules/nlog:logger[@writeTo='logfile']/invalid", "DEBUG", new Dictionary <string, string>()
            {
                { "nlog", "http://www.nlog-project.org/schemas/NLog.xsd" }
            }));

            result.Success.Should().BeFalse();
        }
Пример #2
0
        public void XmlManagerProcessConfigXmlSetting()
        {
            string testConfigFile    = File.ReadAllText(Path.Combine(TestContext.CurrentContext.TestDirectory, "TestFiles", "Config.json"));
            string testAppConfigFile = File.ReadAllText(Path.Combine(TestContext.CurrentContext.TestDirectory, "TestFiles", "app.config"));

            XmlFileManager manager = new XmlFileManager();
            var            result  = manager.Process(testAppConfigFile, new XmlSetting("test", "/configuration/nlog:nlog/nlog:rules/nlog:logger[@writeTo='logfile']/@minlevel", "DEBUG", new Dictionary <string, string>()
            {
                { "nlog", "http://www.nlog-project.org/schemas/NLog.xsd" }
            }));

            result.Success.Should().BeTrue();
            result.Content.Should().NotBeNullOrWhiteSpace();
            result.Content.Should().Contain(@"<logger name=""*"" minlevel=""DEBUG"" writeTo=""logfile"" />");
        }