Created
December 2, 2011 13:35
-
-
Save danielwertheim/1423261 to your computer and use it in GitHub Desktop.
Boilerplate stuff for MSpec
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 class AssemblyInitializer : IAssemblyContext | |
{ | |
private static bool _isInitialized; | |
public void OnAssemblyStart() | |
{ | |
if (_isInitialized) | |
return; | |
_isInitialized = true; | |
} | |
public void OnAssemblyComplete() | |
{ | |
} | |
} | |
public class ContextCleanup : ICleanupAfterEveryContextInAssembly | |
{ | |
public void AfterContextCleanup() | |
{ | |
} | |
} | |
public interface ITestContext | |
{ | |
void Cleanup(); | |
} | |
public class TestContext : ITestContext | |
{ | |
public void Cleanup() | |
{ | |
} | |
} | |
public abstract class SpecificationBase | |
{ | |
protected static ITestContext TestContext; | |
protected static Exception CaughtException; | |
Cleanup after = () => | |
{ | |
if (TestContext != null) | |
TestContext.Cleanup(); | |
CaughtException = null; | |
}; | |
} | |
public class CompleteSpecification : SpecificationBase | |
{ | |
Establish context = () => { }; | |
Because of = () => { }; | |
It should = () => { }; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment