Created
September 1, 2012 02:56
-
-
Save plaurin/3563082 to your computer and use it in GitHub Desktop.
TryCache exemple
This file contains 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
[SetUp] | |
public void SetUp() | |
{ | |
this.memoryAppender = new MemoryAppender(); | |
BasicConfigurator.Configure(this.memoryAppender); | |
... | |
} | |
[Test] | |
public void TestSomething() | |
{ | |
... | |
// Assert | |
Assert.IsFalse( | |
this.memoryAppender.GetEvents().Any(le => le.Level == Level.Error), | |
"Did not expect any error messages in the logs"); | |
} |
This file contains 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 void DoSomething() | |
{ | |
try | |
{ | |
ReallyDoSomething(); | |
} | |
catch (Exception ex) | |
{ | |
this.logger.LogError("An error occured!", ex); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment