Step metadata - adamralph/xbehave.net GitHub Wiki
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(() => ...);
}