コード例 #1
0
        public void ClearLogAtCustomLocationTest()
        {
            Library lib = new Library();
            lib.LogMessage("ERROR", "This is a test log message", @"C:\LogMessageTest");
            lib.ClearLog(@"C:\LogMessageTest");

            StreamReader reader = new StreamReader(@"C:\LogMessageTest\Log.txt");
            string output = reader.ReadLine();
            reader.Close();

            Assert.IsNull(output);

            //Delete test Log file and custom directory
            File.Delete(@"C:\LogMessageTest\Log.txt");
            Directory.Delete(@"C:\LogMessageTest\");
            lib = null;
        }
コード例 #2
0
        public void ClearLogAtDefaultLocationTest()
        {
            Library lib = new Library();
            lib.ClearLog();

            StreamReader reader = new StreamReader(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + @"\MySQLBackup\Log.txt");
            string output = reader.ReadLine();
            reader.Close();

            Assert.IsNull(output);

            lib = null;
        }