예제 #1
0
        public void WriteLog_Succeeds()
        {
            _writeService.WriteLog(Models.LogType.Information, nameof(WriteLog_Succeeds), null, "WriteLog Produces a Log Entry", string.Empty);

            Assert.IsTrue(_mockContext.LogEntries.Count() == 1);
        }
예제 #2
0
 /// <summary>
 /// Write a log entry including details about an exception that has occured.
 /// </summary>
 /// <param name="logType">The severity of the Log Entry.</param>
 /// <param name="source">A reference to the source code which raised this issue.</param>
 /// <param name="exception">The exception which contains information about what went wrong.</param>
 /// <param name="message">A note which will help inform a log viewer about the nature of this message.</param>
 /// <param name="userName">The name of a user which encountered an issue.</param>
 public void WriteLog(LogType logType, string source, Exception exception, string message, string userName)
 {
     _writeService.WriteLog(logType, source, exception, message, userName);
 }
예제 #3
0
        public void GetLatestLogEntries_ReturnsLogEntries()
        {
            // ARRANGE
            _writeService.WriteLog(Models.LogType.Information, nameof(GetLatestLogEntries_ReturnsLogEntries), null, "Test Log Entry 1", string.Empty);
            _writeService.WriteLog(Models.LogType.Information, nameof(GetLatestLogEntries_ReturnsLogEntries), null, "Test Log Entry 2", string.Empty);

            // ACT
            var logEntries = _readService.GetLatestLogEntries(100);

            // ASSERT
            Assert.IsTrue(_mockContext.LogEntries.Count() == 2);
        }