mardi 26 juin 2018

TargetParameterCountException when mocking function to return its input

I have a function that requires mocking out to return one of its parameters.

The function looks as follows:

 IEnumerable<XDocument> WrapDocuments(MessageSettings messageSettings,
        IEnumerable<XDocument> documents);

I am mocking it like this:

 mockDocumentWrapper
      .Setup(m => m.WrapDocuments(It.IsAny<MessageSettings>(), It.IsAny<IEnumerable<XDocument>>()))
      .Returns((IEnumerable<XDocument> x) => x);

When the test which invokes WrapDocuments() runs, I get a TargetParameterCountException. What am I doing wrong here?





Aucun commentaire:

Enregistrer un commentaire