首页 > 解决方案 > 使用 MOQ 获取属性失败,表达式不受支持(不可覆盖的成员)

问题描述

我有这样一行代码:

 foo = _testOutputService.SelectedPoint.PointType;

我的测试试图获得这样的第一个参数:

mockTestOutputService.Setup(x => x.SelectedPoint).Returns(mockSelectedPoint.Object);

但我得到Unsupported expression x=>x.SelectedPoint Non-overridable members

有什么建议么?

谢谢

标签: c#unit-testingmoq

解决方案


推荐阅读