-
Notifications
You must be signed in to change notification settings - Fork 0
Quick start
Michael W Powell edited this page Dec 8, 2020
·
4 revisions
- Ensure you are able to execute xUnit.net tests, in Visual Studio or your environment of choice
- Create a new class library project and add a reference to xWellBehaved.net
- Add the following code to a class file in your project:
namespace Xwellbehaved
{
using Xunit;
public class DebuggingScenarios
{
[Scenario]
public virtual void Addition(int x, int y, int expected, int actual, Calculator calculator)
{
"Let x equal to 1".x(() => x = 1);
"Let y equal to 2".x(() => y = 2);
"Let expected equal to 3".x(() => expected = 3);
"And given calculator".x(() => calculator = new Calculator());
"When x plus y".x(() => actual = calculator.AssertNotNull().Add(x, y));
"Then actual equal to expected".x(() => actual.AssertEqual(expected));
}
}
}
- Execute the scenario in exactly the same way you would normally execute an xUnit.net
Fact
orTheory
Voilà! You just wrote and ran your first xWellBehaved.net scenario. You will see that five successful tests will have run: one for each step in the scenario.
For more information, see Writing scenarios and Running scenarios.
- Home
- Quick start
-
Documentation
- Writing scenarios
- Running scenarios
- Package dependencies
- Debugging scenarios
- Assertions
- Step names
- Debugging Scenarios with examples
- Background methods
- TearDown methods
- Async steps
- Object disposal
- Rollback
- Skipping steps and scenarios
- Step metadata
- Continuing on failure
- Step filters
- Changes in xBehave.net version 2.0
- Changes since deriving from xBehave.net
- Extending xWellBehaved.net
- FAQ
- Known Issues
- Contributions