C#から呼び出すサードパーティのC ++ DLLがあります。
メソッドは静的です。
ユニットテストを行うために抽象化したいので、静的メソッドを含むインターフェイスを作成しましたが、プログラムで次のエラーが発生します。
修飾子「static」はこのアイテムには無効です
MyMethod cannot be accessed with an instance reference; qualify it with a type name instead
どうすればこの抽象化を実現できますか?
私のコードは次のようになります
private IInterfaceWithStaticMethods MyInterface;
public MyClass(IInterfaceWithStaticMethods myInterface)
{
this.MyInterface = myInterface;
}
public void MyMethod()
{
MyInterface.StaticMethod();
}