Skip to content

Instantly share code, notes, and snippets.

@danielwertheim
Created December 2, 2011 13:35
Show Gist options
  • Save danielwertheim/1423261 to your computer and use it in GitHub Desktop.
Save danielwertheim/1423261 to your computer and use it in GitHub Desktop.
Boilerplate stuff for MSpec
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