Wednesday, April 23, 2014

NSubstitute mocking

[TestMethod]
public void underwater_basket_weaving_behaves_as_expected()
{
   var service = Substitute.For<IBasketWeaver>();
   service.WeaveUnderwater(NSubstitute.Arg.Any<int>())
         .Returns(new List<Basket>(){new Basket()});

 
 

I specify NSubstitute before Arg in a set of tests which also have Rhino Mocks mocking sprinkled in to differentiate the Arg of NSubstitute from the Arg.Is(13) syntax of Rhino Mocks.

No comments:

Post a Comment