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

Can't access fixture data when using IUseFixture

Adam Ralph edited this page Apr 22, 2016 · 8 revisions

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(() => ...);
    }
}
Clone this wiki locally