public reduce ( IFn f ) : object | ||
f | IFn | The function to apply. |
Результат | object |
public void ReduceWithStartIterates() { IFn fn = DummyFn.CreateForReduce(); Range r = new Range(2, 5); object ret = r.reduce(fn, 20); Expect(ret, EqualTo(29)); }
public void ReduceWithNoStartIterates() { MockRepository mocks = new MockRepository(); IFn fn = mocks.StrictMock<IFn>(); RMExpect.Call(fn.invoke(2, 3)).Return(5); RMExpect.Call(fn.invoke(5, 4)).Return(7); mocks.ReplayAll(); Range r = new Range(2, 5); object ret = r.reduce(fn); Expect(ret, EqualTo(7)); mocks.VerifyAll(); }