Quantcast
Channel: Telerik Forums RSS
Viewing all articles
Browse latest Browse all 84751

How can you mock a private method call that uses a non accessible enum as a method parameter?

$
0
0

 Here is an example of what I'd like to mock up?  

namespaceExternalAssembly
{
    internalenumHintArg { Flag1,Flag2,Flag3}
    publicclassExternalClass
    {
        privateintMethodToMock(stringname, HintArg hint, outstringresult)
        {
            result ="I want to override this";
            return0;
        }
    }
}

In this example what I'd like to have is a setup that will call the original MethodToMock on everything except when I have a specific name match?

 I have something along the lines of:

stringmockName="mockName";
 
stringmockResult ="new result";
Mock.NonPublic.Arrange(typeof(ExternalClass),"MethodToMock",mockName,ArgExpr.IsAny<HintArg>(),ArgExpr.Out<string>(newResult).Returns(0);

I'm just not sure how to specify the arg expression when the type is an internal that my invoking assembly is not friends with?

 

 

 

 

 


Viewing all articles
Browse latest Browse all 84751

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>