Skip to content

Instantly share code, notes, and snippets.

@tdshipley
Last active January 10, 2018 15:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tdshipley/c75579a87b78c2f6d848f6fcdf31a5e1 to your computer and use it in GitHub Desktop.
Save tdshipley/c75579a87b78c2f6d848f6fcdf31a5e1 to your computer and use it in GitHub Desktop.
Using IDisposable to clean up a test
public class TruthTests : IDisposable
{
public TruthTests()
{
}
public void Dispose()
{
//Do cleanup actions here
//
// e.g.
//
// var database = new Database();
// database.reset();
}
[Fact]
public void TrueEqualsTrue()
{
Assert.Equal(true, true);
}
[Fact]
public void TrueDoesNotEqualFalse()
{
Assert.NotEqual(true, false);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment