How do I run setup and teardown code with each test in MSpec?

I have generic code for setting up and tearing down NHibernate, which I need on pretty much all my tests. Is there a way to include the 'need for all tests' code in one place, then have it applied to all tests? (ie like Nunit's setup and teardown methods)

[Subject("Accessing the TAE allocation page")]
public class when_a_request_to_the_tae_allocation_page_is_made
{
    Establish context = () => NHTestHelper.StartTest(); //need for all tests

    Because of = () => result = new AllocationController(true).Index();

    It should_display_the_page = () => result.ShouldBeAView();

    Cleanup nh = () => NHTestHelper.EndTest(); //need for all tests

    static ActionResult result;
}
9
задан Anthony Mastrean 3 December 2012 в 22:10
поделиться