BDD style unit test for my ASP.NET Core 3 API is erroring. Packages referenced (xunit:2.4.1, xbehave:2.4.1,xunit.runner.visualstudio:2.4.2).
Here is a simplified sample test that results in the same error:
[Fact]
public void Test1()
{
int x=0,
y=0,
sum = 0;
"Given x = 20".x(() => x = 20);
"And y = 10".x(() => y = 10);
"When adding x & y".x(() => sum = x + y);
"Then 30 is returned".x(() => Assert.Equal(30, sum));
}
}
And running the test throw exception:
Message: System.InvalidOperationException : The currently executing thread is not in a step definition context. Stack Trace: CurrentThread.Add(IStepDefinition item) StringExtensions.x(String text, Action body) UnitTest1.Test1() line 15
Aucun commentaire:
Enregistrer un commentaire