jeudi 5 mai 2016

Why use It.is<> or It.IsAny<> if I could just define a variable?

Hi I've been using moq for a while when I see this code.

I have to setup a return in one of my repo.

 mockIRole.Setup(r => r.GetSomething(It.IsAny<Guid>(), It.IsAny<Guid>(), 
                  It.IsAny<Guid>())).Returns(ReturnSomething);

I have three parameters and I just saw these in one of articles or blog on the net.

What is that It.Is<> or It.IsAny<> for an object? if I could use Guid.NewGuid() or other types then why use It.Is?

I'm sorry I'm not sure if my question is right or am I missing some knowledge in testing. But it seems like there is nothing wrong either way.

Aucun commentaire:

Enregistrer un commentaire