public void Common_Create_New_File_On_Size_Limit_Exceed() { TextFileLogger logger = new TextFileLogger("log", 10000); for (int i = 0; i < 200; i++) { logger.Log(String.Format("{0}, Запись в журнале", DateTime.Now)); } Assert.IsTrue(File.Exists("log-0.log")); FileInfo fileInfo = new FileInfo("log-0.log"); Assert.IsTrue(fileInfo.Length > 10000); Assert.IsTrue(File.Exists("log-1.log")); StreamReader streamReader = new StreamReader(new FileStream("log-1.log", FileMode.Open, FileAccess.Read, FileShare.ReadWrite)); Assert.IsTrue(streamReader.ReadLine().Contains("Запись в журнале")); streamReader.Close(); streamReader.Dispose(); logger.Dispose(); }
public void Dispose() { if (_watcher != null) { _watcher.Dispose(); } if (_logger != null) { _logger.Dispose(); } }
public void DisposeProvider() { logger.Dispose(); }