Skip to content

Instantly share code, notes, and snippets.

@neiled
Created August 2, 2011 12:00
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 neiled/1120061 to your computer and use it in GitHub Desktop.
Save neiled/1120061 to your computer and use it in GitHub Desktop.
GivenSpecification for Automated Acceptance Testing
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace IntegrationTestUtils
{
public abstract class GivenSpecification
{
public TestContext TestContext { get; set; }
/// <summary>
/// Steps that are run before each test.
/// </summary>
[TestInitialize]
public void TestInitialize()
{
Given();
When();
}
/// <summary>
/// Steps that are run after each test.
/// </summary>
[TestCleanup]
public void TestCleanup()
{
Cleanup();
}
/// <summary>
/// Sets up the environment for a specification context.
/// </summary>
protected virtual void Given()
{
}
/// <summary>
/// Acts on the context to create the observable condition.
/// </summary>
protected virtual void When()
{
}
/// <summary>
/// Cleans up the context after the specification is verified.
/// </summary>
protected virtual void Cleanup()
{
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment