你需要使用Expect.Do()方法来获取委托.然后,这个委托需要"做"某事,代替调用代码.因此,编写一个为您填充fields变量的委托.
private int SetupFields( object[] fields ) { fields[ 0 ] = 100; fields[ 1 ] = "Hello"; return 2; } [Test] public void TestGetValues() { MockRepository mocks = new MockRepository(); using ( mocks.Record() ) { Expect .Call( reader.GetValues( null ) ) .IgnoreArguments() .Do( new Func