Skip to content

Additional methods in fluent syntax causes exception 'variable referenced from scope ... but it is not defined' #251

Description

@develorem

System: Nunit test, resharper test runner, .Net 4.6, BDDfy version 4.1.2

Example code:

this.Given(x => x.GivenTheSiteCoverageService())
       .And(x => x.GivenTheFirstAerialJobSite().WithCoverage(80m).OverSite(FirstSite))
       ....

Effectively, putting the additional methods "WithCoverage" and "OverSite" causes BDDFY to fail with exception:

An exception of type 'System.InvalidOperationException' occurred in System.Core.dll but was not handled in user code

Additional information: variable 'x' of type '' referenced from scope '', but it is not defined

Removing the fluent extensions I created for my types allows it to work.
But the alternative of complex unreadable constructors for all my permutations is wrong (shouldn't have to change the object under test). Is there a way to achieve what I'm trying to achieve here?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions