Exemple #1
0
        public void TestAppendersIsIAppender()
        {
            var simpleLayout = new SimpleLayout();
            var xmlLayout = new XmlLayout();

            var fileAppender = new FileAppender(simpleLayout);
            IAppender fileAppenderXml = new FileAppender(xmlLayout);

            Assert.IsInstanceOfType(fileAppender, typeof(IAppender), "This fileAppender is not IAppender.");
            Assert.IsInstanceOfType(fileAppenderXml, typeof(IAppender), "This fileAppenderXml is not IAppender.");
        }
Exemple #2
0
        public void TestAppendersMissingFilePath()
        {
            var pathTxt = string.Empty;
            var pathXml = string.Empty;

            var simpleLayout = new SimpleLayout();
            var xmlLayout = new XmlLayout();

            var fileAppender = new FileAppender(simpleLayout);
            IAppender fileAppenderXml = new FileAppender(xmlLayout);

            fileAppender.File = pathTxt;
            fileAppenderXml.File = pathXml;
        }
Exemple #3
0
        public void TestAppendersFilePath()
        {
            string pathTxt = "../../log.txt";
            string pathXml = "../../log.xml";

            var simpleLayout = new SimpleLayout();
            var xmlLayout = new XmlLayout();

            var fileAppender = new FileAppender(simpleLayout);
            IAppender fileAppenderXml = new FileAppender(xmlLayout);
            
            fileAppender.File = pathTxt;
            fileAppenderXml.File = pathXml;

            Assert.AreEqual(pathTxt, fileAppender.File, "This is not same path for log.txt.");
            Assert.AreEqual(pathXml, fileAppenderXml.File, "This is not same path for log.xml.");
        }