ほとんどすべてのテストで必要な NHibernate をセットアップおよび破棄するための汎用コードがあります。「すべてのテストの必要性」コードを 1 か所に含めて、それをすべてのテストに適用する方法はありますか? (つまり、Nunitsetup
とteardown
メソッドのように)
[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;
}