Skip to content
This repository has been archived by the owner on Jun 12, 2021. It is now read-only.

Step metadata

Adam Ralph edited this page Aug 26, 2018 · 3 revisions

The context object that is passed into a step delegate gives you access to metadata about the current step and scenario.

For example, you may want to interact with the file system isolate all your actions in a dedicated directory for the scenario:

[Scenario]
public void SomeScenario(string directory)
{
    "Given a directory"
        .x(c => Directory.CreateDirectory(directory = c.Step.Scenario.DisplayName))
        .Teardown(() => Directory.Delete(directory));

    "When..."
        .x(() => ...);

    "Then..."
        .x(() => ...);
}
Clone this wiki locally