Esempio n. 1
0
        static void Main(string[] args)
        {
            var jobLoger = new JobLogger2(true, true, false, true);
            jobLoger.LogAsMessage("   ");
            jobLoger.LogAsMessage("this is a message   ");
            jobLoger.LogAsWarning("this is a warning");
            jobLoger.LogAsError("this is an error");

            Console.ReadKey();
        }
Esempio n. 2
0
        public void TestFileLog()
        {
            ILogDestination consoleWriterInjector = new ConsoleTest();
            ILogDestination fileWriterInjector = new FileTest();
            ILogDestination dataBaseWriterInjector = new DataBaseTest();

            var jobLogger = new JobLogger2(false, true, false, false);

            //aplicar ID x set
            jobLogger.LoggerConsole = consoleWriterInjector;
            jobLogger.LoggerFile = fileWriterInjector;
            jobLogger.LoggerDataBase = dataBaseWriterInjector;

            jobLogger.LogAsMessage("test");
            jobLogger.LogAsWarning("test");
            jobLogger.LogAsError("test");

            Assert.AreEqual(((DataBaseTest)dataBaseWriterInjector).GetResults().Count, 0);
            Assert.AreEqual(((FileTest)fileWriterInjector).GetResults().Count, 3);
            Assert.AreEqual(((ConsoleTest)consoleWriterInjector).GetResults().Count, 0);
        }