This repository has been archived by the owner on Jun 12, 2021. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 46
Async steps
Adam Ralph edited this page Nov 1, 2017
·
4 revisions
xBehave.net provides the ability to define asynchronous steps using the async
and await
keywords.
[Scenario]
public void Addition(int x, int y, AsyncCalculator calculator, int answer)
{
"Given the number 1"
.x(() => x = 1);
"And the number 2"
.x(() => y = 2);
"And an asynchronous calculator"
.x(() => calculator = new AsyncCalculator());
"When I add the numbers together"
.x(async () => answer = await calculator.Add(x, y));
"Then the answer is 3"
.x(() => answer.Should().Be(3));
}