mercredi 10 février 2016

Have mocked method output different out param each call with MOQ

Is there a way with MOQ to have sequential calls on a method return different out parameters? For a quick example getting the method:

public void OutputANumber(out number)

to output 1, followed by 2 (ignore the fact it could return int, it's for an example only not real code).

int number = 1;
mock.Setup(n => n.OutputANumber(out number)
number = 2;
mock.Setup(n => n.OutputANumber(out number)

Doesn't work as the second setup overrides the first, likewise a SetupSequence only allows for sequential returns.

Aucun commentaire:

Enregistrer un commentaire