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; }
public void GetLogTextCustomDefaultLocation() { Library lib = new Library(); lib.LogMessage("ERROR", "This is a test log message", @"C:\LogMessageTest"); Assert.IsNotNull(lib.GetLogText(@"C:\LogMessageTest")); //Delete test Log file and custom directory File.Delete(@"C:\LogMessageTest\Log.txt"); Directory.Delete(@"C:\LogMessageTest\"); lib = null; }
public void LogMessageAtDefaultLocationTest() { Library lib = new Library(); lib.LogMessage("INFO", "This is a test log message"); StreamReader reader = new StreamReader(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + @"\MySQLBackup\Log.txt"); string output = reader.ReadLine(); reader.Close(); Assert.IsTrue(File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + @"\MySQLBackup\Log.txt")); //Delete test Log file File.Delete(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + @"\MySQLBackup\Log.txt"); lib = null; }