public ComplexOrderingTests() { recorder = new UnorderedMethodRecorder(new ProxyMethodExpectationsDictionary()); nestedRecorder = new UnorderedMethodRecorder(new ProxyMethodExpectationsDictionary()); recorder.AddRecorder(nestedRecorder); proxy = new object(); method = typeof (object).GetMethod("ToString"); expectation = new AnyArgsExpectation(new FakeInvocation(method), new Range(1, 1)); args = new object[0]; }
public MethodRecorderBaseTests() { recorder = new UnorderedMethodRecorder(new ProxyMethodExpectationsDictionary()); testRecorder = new TestMethodRecorder(); recorder.AddRecorder(testRecorder); proxy = new object(); method = typeof(object).GetMethod("ToString"); expectation = new AnyArgsExpectation(new FakeInvocation(method), new Range(1, 1)); args = new object[0]; }
/// <summary> /// Adds the recorder and turn it into the active recorder. /// </summary> /// <param name="recorder">Recorder.</param> public void AddRecorder(IMethodRecorder recorder) { if (recorderToCall != null) { recorderToCall.AddRecorder(recorder); } else { DoAddRecorder(recorder); recorderToCall = recorder; } }
public void ReplaceExpectationWhenNestingOrdering() { recorder.AddRecorder(CreateRecorder()); recorder.Record(this.demo, this.voidNoArgs, expectationOne); AnyArgsExpectation newExpectation = new AnyArgsExpectation(new FakeInvocation(voidNoArgs), new Range(1, 1)); recorder.ReplaceExpectation(demo, voidNoArgs, expectationOne, newExpectation); ExpectationsList list = recorder.GetAllExpectationsForProxyAndMethod(demo, voidNoArgs); Assert.Same(newExpectation, list[0]); }