I'm not expert with mocking, but I know mocks advantages. I face with a problem where I have an interface you can see it below. I want to Setup this interface get property in the right way.
public interface IInterface
{
string this[string key] { get; }
}
I tried something like this:
Mock<IInterface> mockInterface = new Mock<IInterface();
mockInterface.SetupGet(mockInterface.Object).Returns("Test");
But I get the following error:
Error CS0411 The type arguments for method 'Mock.SetupGet(Expression>)' cannot be inferred from the usage. Try specifying the type arguments explicitly.
Can you give me some advice or solution for this problem?