带有linq函数的typemock包含fake和Members.MustSpecificReturnValues
如果我有一个typemock测试,它伪造了一个成员必须指定返回值的实例,如下所示:带有linq函数的typemock包含fake和Members.MustSpecificReturnValues,linq,c#-4.0,typemock,Linq,C# 4.0,Typemock,如果我有一个typemock测试,它伪造了一个成员必须指定返回值的实例,如下所示: WallLayers layers = Isolate.Fake.Instance<WallLayers>(Members.MustSpecifyReturnValues); Isolate.WhenCalled(() => layers.GetCoreProfile()).CallOriginal(); WallLayers layers=Isolate.Fake.Instance(Memb
WallLayers layers = Isolate.Fake.Instance<WallLayers>(Members.MustSpecifyReturnValues);
Isolate.WhenCalled(() => layers.GetCoreProfile()).CallOriginal();
WallLayers layers=Isolate.Fake.Instance(Members.mustSpecificReturnValues);
隔离.WhenCalled(()=>layers.GetCoreProfile()).CallOriginal();
如果在原始GetCoreProfile方法中,我有一个linq查询
wallPoints = fe.GetFacePointsConstrainedBy<Int32>(FaceExtractor.BottomFace, constraints, selector1)
.Where(p => p.Z == wallReferenceLevel)
wallPoints=fe.GetFacePointsConstrainedBy(FaceExtractor.BottomFace,约束,选择器1)
其中(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
TypeMock.TypeMock异常:
***意外调用AU.Com.monar.Model.Revit.WallLayers。