如果我有一个类型模拟测试,它伪造了一个成员必须指定返回值的实例,如下所示:
WallLayers layers = Isolate.Fake.Instance<WallLayers>(Members.MustSpecifyReturnValues);
Isolate.WhenCalled(() => layers.GetCoreProfile()).CallOriginal();
如果在原始的GetCoreProfile方法中,我有一个linq查询
wallPoints = fe.GetFacePointsConstrainedBy<Int32>(FaceExtractor.BottomFace, constraints, selector1)
.Where(p => p.Z == wallReferenceLevel)
运行测试时抛出以下异常
TypeMock.TypeMockException:
*** Unexpected Call to AU.Com.Monarch.Model.Revit.WallLayers.<GetCoreProfile()
at dm.b(Object A_0, String A_1, String A_2, MethodBase A_3, Object[] A_4, Object A_5)
at Typemock.Interceptors.Profiler.InternalMockManager.getReturn(Object that, String typeName, String methodName, Object methodParameters, Boolean isInjected, Boolean isInterceptedType, Object p1)
at AU.Com.Monarch.Model.Revit.WallLayers.<>c__DisplayClass1a.<GetCoreProfile>b__8(Point3D`1 p) in C:\revitMBS\source\ExternalFrame\ExternalFrame\Monarch\Model\Revit\WallLayers.cs:line 278
感谢您事先提出的意见。