Moq Invalid callback. Setup on method with parameters cannot callback with parameters C#

4.5k views Asked by At

I am pretty new to using Moq in C#, and I am trying to amend an existing test to take in some amended parameters, but when I try running the unit test, I am getting the error message

" Invalid callback. Setup on method with parameters cannot callback with parameters"

My mocked out method is thus:

 mockFileDeletionService
    .Setup(mq => mq.DeleteFileAndReport(It.IsAny<IEnumerable<Uri>>(),It.IsAny<IEnumerable<Uri>>(),It.IsAny<IList<long>>(), false))
    .Callback<IEnumerable<Uri>,IEnumerable<Uri>,List<long>, bool>((files, directory, ids, types) => {
          filesIn = files;
          directIn = directory;
          idIn = ids;
          typesIn = types;
      })
    .Returns(results)

Sorry, but where am I going wrong?

0

There are 0 answers