Exemple #1
0
        public void TestLoggingToFile()
        {
            var targetFileToLogInto = EnvironmentV2.instance.GetOrAddTempFolder("TestLoggingToFile").GetChild("log.txt");

            targetFileToLogInto.DeleteV2();

            ILog fileLogger = new LogToFile(targetFileToLogInto);
            var  logText    = "!! Test LogDebug 123 !!";

            fileLogger.LogDebug(logText);
            SendSomeEventsToLog(fileLogger);
            LogToFile.LogStructure logStructure = LogToFile.LoadLogFile(targetFileToLogInto);
            Assert.NotNull(logStructure);
            List <LogToFile.LogEntry> entries = logStructure.logEntries;

            Assert.Equal(5, entries.Count);
            Assert.Contains(logText, entries.First().d);
        }