Accessing the original arguments of Expect() when assembling the value in Returns()

跟風遠走 提交于 2019-12-04 22:27:47
BenA

From the moq quickstart guide:

// access invocation arguments when returning a value
mock.Setup(x => x.Execute(It.IsAny<string>()))
                .Returns((string s) => s.ToLower());

Which suggests therefore that you can fill in your ??? as

CollectionMock.Expect(c => c.GetById(It.IsAny<List<int>>()))
              .Returns((List<int> l) => //Do some stuff with l
                      );
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!