使用Typemock和Opencover执行单元测试用例时,获取System.InvalidOperation异常

时间:2019-03-27 03:19:08

标签: .net unit-testing serialization opencover typemock-isolator

当我尝试执行一种测试方法时,它失败,但出现以下异常:

System.InvalidOperationException: _5MSCAPTVvCE53ofLWmErNt4nvNO_._n18Eb1DF6eMsCxaJ9Z8eBYuIm18_ is inaccessible due to its protection level. Only public types can be processed.

Looking at the stack trace it is confirmed that, error is originating while mocking an object using Isolate.Fake.AllInstances method. which looks something like this.

Isolate.Fake.AllInstances<Dependency>(Members.ReturnRecursiveFakes, ConstructorWillBe.Ignored);

也已验证,所有类及其成员均为public类型。

0 个答案:

没有答案