public void TestPipeConnectorSendsCallRequest() { Mock <IFormatter> formatterMock = new Mock <IFormatter>(); Mock <IWrapperProcessStarter> wrapperProcessStarterMock = new Mock <IWrapperProcessStarter>(); Mock <PipeStreamFactory> pipeStreamFactoryMock = GetPipeStreamFactoryMock(); PipeToken pipeToken = new PipeToken(Guid.NewGuid().ToString()); IPipeConnector pipeConnector = new PipeConnector(formatterMock.Object, wrapperProcessStarterMock.Object, pipeStreamFactoryMock.Object, pipeToken); CallData callDataToSend = new CallData(); pipeConnector.SendCallRequest(callDataToSend); formatterMock.Verify(mock => mock.Serialize(It.IsAny <PipeStream>(), It.Is <CallData>(actual => ReferenceEquals(actual, callDataToSend))), Times.AtLeast(1)); }
public void TestPipeConnectorOpensPipe() { Mock <IFormatter> formatterMock = new Mock <IFormatter>(); Mock <IWrapperProcessStarter> wrapperProcessStarterMock = new Mock <IWrapperProcessStarter>(); Mock <PipeStreamFactory> pipeStreamFactoryMock = GetPipeStreamFactoryMock(); PipeToken pipeToken = new PipeToken(Guid.NewGuid().ToString()); IPipeConnector pipeConnector = new PipeConnector(formatterMock.Object, wrapperProcessStarterMock.Object, pipeStreamFactoryMock.Object, pipeToken); CallData callDataToSend = new CallData(); pipeConnector.SendCallRequest(callDataToSend); pipeStreamFactoryMock.Verify(mock => mock.GetConnectedPipeStream(It.Is <PipeToken>(actual => Equals(actual, pipeToken))), Times.Once); }