jeudi 4 février 2016

Unable to mock ref object[] using MOQ

I am trying to mock a method call using MOQ. Method takes one string, two object ref array parameters.

Method Definition:

bool method1(string string1, ref object[] objectArray, ref object[] objectArray);

MOQ Setup:

var sampleArray = new object[1] { "test" };

interfaceObject.Setup(m => m.method1(It.IsAny<string>(), ref sampleArray, ref sampleArray)).Returns(true);

When i try to mock ref object as a parameter its working and i am getting the required output.

But when i tried to mock ref array object as a parameter its not working and also its not throwing any error.

Can someone help me to understand the issue with mocking ref array object parameters.

Aucun commentaire:

Enregistrer un commentaire