示例#1
0
        public async Task Receive()
        {
            var protocolMock = new Mock <TransferProtocolReceiver>();
            var server       = new nRpc.Server.Server(protocolMock.Object);
            await server.Start(CancellationToken.None);

            protocolMock.Verify(p => p.Receive());
        }
示例#2
0
        public async Task HandleIncomingRequest()
        {
            var protocolMock = new Mock <TransferProtocolReceiver>();
            var server       = new nRpc.Server.Server(protocolMock.Object);
            await server.HandleIncomingStream();

            protocolMock.Verify(p => p.GetRequestFunctionAsync());
            protocolMock.Verify(p => p.ReadRequestAsync());
            protocolMock.Verify(p => p.SendResponseAsync(It.IsAny <IEnumerable <KeyValuePair <string, string> > >(), It.IsAny <byte[]>()));
        }