mardi 24 février 2015

NSubstitute mock extension method

I want to do mock extension method, but it does not work. How can this be done?



public static class RandomExtensions
{
public static IEnumerable<int> NextInt32s(this System.Random random, int neededValuesNumber, int minInclusive, int maxExclusive){...}
}
....
[Fact]
public void Select()
{
var randomizer = Substitute.For<DefaultRandom>();
randomizer.NextInt32s(3, 1, 10).Returns(new int[] { 1, 2, 3 });
}




Aucun commentaire:

Enregistrer un commentaire