lundi 28 mars 2016

Moq - Setup .Equals method to return false

I can't figure out how to make Moq setup the .Equals method on objects. The following assertion fails:

var Song = new Mock<ISong>();
Song.Setup(x => x.Equals(Song.Object))
    .Returns(false);

Assert.IsFalse(Song.Object.Equals(Song.Object));

In other words, Song.Object.Equals(Song.Object) always returns true.

Is it at all possible to mock the .Equals method with Moq? What am I missing?

Aucun commentaire:

Enregistrer un commentaire