Example #1
0
        public void WriteLog()
        {
            LittleLogger logger =
                new LittleLogger("../../Test_Data/TinyMathTest/LittleLoggerTest/WriteLog/log.txt");

            // Clear log file
            logger.ClearLog();

            // Messages
            List<string> msgList = new List<string>();
            msgList.Add("02.06.2014:12.12.12 Error!");
            msgList.Add("02.07.2015:12.16.18 No errors!");

            // Write messages in log file
            foreach (string msg in msgList)
                logger.WriteLog(msg);

            // Asserts
            using (StreamReader reader =
                new StreamReader("../../Test_Data/TinyMathTest/LittleLoggerTest/WriteLog/log.txt"))
            {
                int i = 0;
                while (!reader.EndOfStream)
                {
                    Assert.AreEqual(msgList[i], reader.ReadLine());
                    ++i;
                }
            }
        }
Example #2
0
 // Constructor
 public MathHelper(string logfilepath)
 {
     logger = new LittleLogger(logfilepath);
 }