Пример #1
0
 public void AddLogLine(LogLine logLine)
 {
     try
     {
         _curDate = _dHelper.DateCheckAndCreateFile(_curDate, logLine.Timestamp);
         _dHelper.AddLineToFile(logLine);
     }
     catch (Exception e)
     {
         _dHelper.AddLineToFile(new LogLine()
         {
             Text = e.ToString(), Timestamp = DateTime.Now
         });
     }
 }
Пример #2
0
        public void AddLineToFile_LogLineIsSet_StringFormat()
        {
            //Arrange
            var dh = new DocumentHelper(_testDirectory);

            dh.CreateDirectory();
            dh.CreateFile(DateTime.Now);
            LogLine logLine = new LogLine();

            // Act
            Action act = () => dh.AddLineToFile(logLine);

            // Assert
            act.ShouldNotThrow();
        }
Пример #3
0
        public void AddLineToFile_LogLineIsNull_ThrowsNullReferenceException()
        {
            // Arrange
            var dh = new DocumentHelper(_testDirectory);

            dh.CreateDirectory();
            dh.CreateFile(DateTime.Now);
            LogLine logLine = null;

            // Act
            Action act = () => dh.AddLineToFile(logLine);

            // Assert
            act.ShouldThrow <NullReferenceException>();
        }