var mock = new Mock<IMyClass>();
mock.SetupSequence(x => x.MyMethod()).Returns(0).Returns(1).Returns(2).
Func<IMyClass> func = () => mock.Object);
I tried to mock object in Func<mock.Object>
using SetupSequence
, Queue
or Callback
.
In further methods, my Func is invoked and then MyMethod of interface is executed. It works locally well however AzureDevops seems to take only last Returns(2). Azure devops doesn't treat it as sequence. I have loop in my program and I need multiple results. Due to this issue assertion doesn't work. Azure devops seems to not recognize mock method. I have many working test based on moq, but this one is so tricky.
Please help.
Aucun commentaire:
Enregistrer un commentaire