Created
August 22, 2012 22:10
-
-
Save ElemarJR/3429915 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class LogEntry | |
| { | |
| class DefaultCurrentDateProvider | |
| : ICurrentDateProvider | |
| { | |
| public DateTime GetCurrentDate() | |
| { | |
| return DateTime.Now; | |
| } | |
| } | |
| public LogEntry( | |
| string message, | |
| IOutput output = null, | |
| ICurrentDateProvider currentDateProvider = null ) | |
| { | |
| this.Message = message; | |
| if (currentDateProvider == null) | |
| currentDateProvider = new DefaultCurrentDateProvider(); | |
| this.When = currentDateProvider.GetCurrentDate(); | |
| if (output != null) | |
| output.Write(this); | |
| } | |
| public string Message { get; private set; } | |
| public DateTime When { get; private set; } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment