You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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?
The text was updated successfully, but these errors were encountered:
at System.Linq.Expressions.Compiler.VariableBinder.Reference(ParameterExpression node, VariableStorageKind storage)
at System.Linq.Expressions.Compiler.VariableBinder.VisitParameter(ParameterExpression node)
at System.Linq.Expressions.ExpressionVisitor.VisitMethodCall(MethodCallExpression node)
at System.Linq.Expressions.Compiler.VariableBinder.VisitUnary(UnaryExpression node)
at System.Linq.Expressions.ExpressionVisitor.Visit(ReadOnlyCollection1 nodes) at System.Linq.Expressions.Compiler.VariableBinder.VisitLambda[T](Expression1 node)
at System.Linq.Expressions.Compiler.LambdaCompiler.Compile(LambdaExpression lambda, DebugInfoGenerator debugInfoGenerator)
at TestStack.BDDfy.ExpressionExtensions.ArgumentExtractorVisitor.GetValue(Expression a)
at TestStack.BDDfy.ExpressionExtensions.ArgumentExtractorVisitor.ExtractStepArgument(Expression a)
at System.Linq.Enumerable.WhereSelectEnumerableIterator2.MoveNext() at System.Collections.Generic.List1.InsertRange(Int32 index, IEnumerable1 collection) at TestStack.BDDfy.ExpressionExtensions.ArgumentExtractorVisitor.VisitMethodCall(MethodCallExpression node) at System.Linq.Expressions.ExpressionVisitor.VisitLambda[T](Expression1 node)
at TestStack.BDDfy.ExpressionExtensions.ExtractArguments[T](LambdaExpression expression, T value)
at TestStack.BDDfy.FluentScanner1.AddStep(Action1 action, LambdaExpression stepAction, String stepTextTemplate, Boolean includeInputsInStepTitle, Boolean reports, ExecutionOrder executionOrder, Boolean asserts, String stepPrefix)
at TestStack.BDDfy.FluentStepBuilder1.And(Expression1 step)
I suspect the offending code is the fact that the ExpressionExtensions.ArgumentExtractorVisitor.GetValue() method assumes a Func<object> when in fact the first call in my method chain returns an object as well.
I added another method onto the chain that returned the current TScenario, and then called yet another method from TScenario (which did nothing) and it now works. Having these two extra methods is a bit lame. Also it sees that last method in the call chain as the one doing the work so it pulls name information from that one, rather than the first one (no problem on that, can specify the string to show).
System: Nunit test, resharper test runner, .Net 4.6, BDDfy version 4.1.2
Example code:
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?
The text was updated successfully, but these errors were encountered: