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 Sep 29, 2013
·
6 revisions
Of course!
You can use any isolation library you like with xBehave.net. Our recommendation is FakeItEasy.
E.g.
public class CandyShopFeature
{
[Scenario]
public void BuyingCandy(ICandy lollipop, ICandyShop shop, SweetTooth developer)
{
"Given a shop with a top selling candy"
.Given(() =>
{
lollipop = A.Fake<ICandy>();
shop = A.Fake<ICandyShop>();
A.CallTo(() => shop.GetTopSellingCandy()).Returns(lollipop);
});
"And a sweet tooth developer"
.And(() => developer = new SweetTooth());
"When the developer buys the tastiest candy from the shop"
.When(() => developer.BuyTastiestCandy(shop));
"Then the developer should have bought the top selling candy"
.Then(() => A.CallTo(() => shop.BuyCandy(lollipop)).MustHaveHappened());
}
}