Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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