I tried for searching a lot regarding this but did not find any helpful information. And I'm stuck in below situation and seeking for help.
Below is my method which I want to test:
public void MethodToTest()
{
this._app = this.GetApp(out this._pId);
}
//here beelow method which is from the same class and private
private Microsoft.Office.Interop.Word.Application GetApp(out int processId)
{
//some code which returns Application
}
Now I dont want to execute this method instead I want to shim this method using
ShimMyclassName.Allinstances.set_GetAppInt32Out = () => my expected output
But compiler is throwing error:
cannot assign to set_GetAppInt32Out because it's a method group.
So I tried to changed it to:
ShimMyclassName.Allinstances.set_GetAppInt32Out( here it is expecting some out delegate like (OutFunc<WordApplication, int, Microsoft.office.Interop.Word.Application> Value)
In ShimMyClass below is the signature: public void set_GetAppInt32Out(object value);
So I'm stuck here. How can I pass the value and How I can Break the private method call and expect it to return my expected output instead of executing the original private method?