Created
September 28, 2017 09:36
-
-
Save HamidMosalla/3e7072c7f1ba879cf27d3c1edf34b43d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Moq | |
var lollipop = new Mock<ICandy>(); | |
var shop = new Mock<ICandyShop>(); | |
shop.Setup(s => s.GetTopSellingCandy()).Returns(lollipop); | |
shop.Verify(s => s.BuyCandy(lollipop), Times.AtMostOnce()); | |
//NSubstitude | |
var lollipop = Substitute.For<ICandy>(); | |
var shop = Substitute.For<ICandyShop>(); | |
shop.GetTopSellingCandy().Returns(lollipop); | |
shop.Received().BuyCandy(lollipop); | |
//FakeItEasy | |
var lollipop = A.Fake<ICandy>(); | |
var shop = A.Fake<ICandyShop>(); | |
A.CallTo(() => shop.GetTopSellingCandy()).Returns(lollipop); | |
A.CallTo(() => shop.BuyCandy(lollipop)).MustHaveHappened(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment