public void TestToCheckWorkingOfLogFile() { string testFile = "../../../../Test Files/TestFileForLogFile.txt"; LogFileLibrary.LogFile obj = new LogFileLibrary.LogFile(testFile, "abcd"); obj.WriteToLogFile(); Assert.True(File.ReadAllText(testFile) != ""); }
public int FormatChecker(string logFile) { for (int i = 1; i < buffer.Length; i++) { if (!(buffer[i].Contains(','))) { LogFileLibrary.LogFile obj = new LogFileLibrary.LogFile(logFile, "DEVICE MALFUNCTION"); obj.WriteToLogFile(); return(0); } } return(1); }
public int ReadingData(string filePath, string logFile) { try { buffer = System.IO.File.ReadAllLines(filePath); if (buffer.Length <= 1) { LogFileLibrary.LogFile obj = new LogFileLibrary.LogFile(logFile, "EMPTY FILE"); obj.WriteToLogFile(); return(0); } } catch (Exception e) { LogFileLibrary.LogFile obj = new LogFileLibrary.LogFile(logFile, "FILE NOT FOUND"); obj.WriteToLogFile(); Console.WriteLine(e.Message); } return(1); }
public void SendMessage(string message) { Console.WriteLine($"Email Reporter : {message}"); LogFileLibrary.LogFile obj = new LogFileLibrary.LogFile("../../../logfile.txt", message); obj.WriteToLogFile(); }