[英]How do I mock an array in Rhino mocks
I am using Rhino mocks and now I need to mock an array IFindUseCase[] 我正在使用Rhino模拟,现在我需要模拟一个数组IFindUseCase []
var findUseCases = mocks.StrictMock<IFindUseCase[]>();
But how do I use Expect.Call? 但是如何使用Expect.Call?
I thought it would be this, but may be not....! 我以为是这样,但可能不是。
Expect.Call(() => findUseCases[0].Process(null)).Return(null);
Any ideas? 有任何想法吗?
I don't think you want to be creating a mock array, I think you want to create an array of mocks. 我不认为您要创建模拟数组,我想您要创建模拟数组。
var case1 = mocks.StrictMock<IFindUseCase>();
var findUseCases = new IFindUseCase[]
{
case1
};
And setup your expectation: 并设定您的期望:
case1.Expect(m => m.Process(null)).Return(null);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.