Why when I am trying to use a mock like this:
public void Test(string param=null){
MyMock.Setup(x=>x.foo(param ?? It.IsAny<string>));
}
This obviously works fine
public void Test(string param=null){
if(param==null)
MyMock.Setup(x=>x.foo(It.IsAny<string>));
else
MyMock.Setup(x=>x.foo(param));
}
But why is that? the "param ?? It.IsAny" returns param or It.IsAny what am I missing here?