コード例 #1
0
        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));
        }
コード例 #2
0
        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);
        }