/// <summary> /// Process synchronous messages through the sink chain. Mocking can be applied here. /// </summary> public IMessage SyncProcessMessage(IMessage msg) { IMethodCallMessage mcm = (IMethodCallMessage)msg; IMethodReturnMessage result; if (RecorderManager.IsPlaying && RemotingMockService.IsUriToMock(mcm.Uri)) { MockingProxy proxy = new MockingProxy(Type.GetType(mcm.TypeName), new RemotingPlayBackMocker(), mcm.Uri); result = (IMethodReturnMessage)proxy.Invoke(msg); } else if (RecorderManager.IsRecording && !RecorderManager.IsInCall && RemotingMockService.IsUriToMock(mcm.Uri)) { MockingProxy proxy = new MockingProxy(Type.GetType(mcm.TypeName), null, mcm.Uri); MockableCall call = new MockableCall(proxy, mcm); using (new RecorderManager.Lock()) { result = SyncProcessMessageOnServer(mcm); call.SetResult(result); RecorderManager.RecordCall(call); } } else { result = (IMethodReturnMessage)nextMessageSink.SyncProcessMessage(msg); } return(result); }
public void PlayBackCall(MockableCall actualCall) { MockableCall expectedCall = (MockableCall)this.records[this.pointer++]; Assert.AreEqual(expectedCall.MethodSignature, actualCall.MethodSignature); actualCall.SetResult(expectedCall); }