How do I MOQ the System.IO.FileInfo class… or any other class without an interface?

前端 未结 3 893
死守一世寂寞
死守一世寂寞 2020-12-05 13:49

I am writing a number of unit tests for a logger class I created and I want to simulate the file class. I can\'t find the interface that I need to use to create the MOQ...

3条回答
  •  隐瞒了意图╮
    2020-12-05 14:07

    This might help you to ease the creation of wrapper classes for static or non-mockable 3rd party classes. This tool will generated Interface and a concrete wrapper class of any existing class such as System.IO right on your Visual Studio Project.

    https://www.nuget.org/packages/Digitrish.WrapperGenerator/

提交回复
热议问题