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
Can I use xbehave.net with isolation (faking mocking substitution) libraries?
Adam Ralph edited this page Feb 23, 2018
·
6 revisions
Of course!
You can use any isolation library you like with xBehave.net.
Our recommendation is FakeItEasy.
E.g.
using FakeItEasy;
public class CandyShopFeature
{
[Scenario]
public void BuyingCandy(ICandy lollipop, ICandyShop shop, SweetTooth developer)
{
"Given a shop with a top selling candy"
.x(() =>
{
lollipop = A.Fake<ICandy>();
shop = A.Fake<ICandyShop>();
A.CallTo(() => shop.GetTopSellingCandy()).Returns(lollipop);
});
"And a sweet tooth developer"
.x(() => developer = new SweetTooth());
"When the developer buys the tastiest candy from the shop"
.x(() => developer.BuyTastiestCandy(shop));
"Then the developer should have bought the top selling candy"
.x(() => A.CallTo(() => shop.BuyCandy(lollipop)).MustHaveHappened());
}
}