Can't access fixture data when using IUseFixture - adamralph/xbehave.net GitHub Wiki

This issue affects 1.x versions only. It does not affect versions 2.x and above.

A bug was raised for this but it will not be fixed.

The workaround is to make the field which stores your fixture data static, e.g.:

public class MyFeature : IUseFixture<MyFixture>
{
    public void SetFixture(MyFixture myFixture)
    {
        this.MyFixture = myFixture;
    }

    private static MyFixture MyFixture { get; set; }

    [Scenario]
    public void MyScenario()
    {
        "Given my fixture"
            .f(() => { });

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

        "Then..."
            .f(() => ...);
    }
}
⚠️ **GitHub.com Fallback** ⚠️