示例#1
0
        public void ClientInvokeDelegate()
        {
            var port = Interlocked.Increment(ref _nextPort);

            using (var server = new TestServer(port))
            {
                bool called = false;
                server.Bind("DelegateFunction", (Func <int, string, string>)((a, b) =>
                {
                    called = b == "abc";
                    return(b);
                }));

                using (var client = new TestClient(port))
                {
                    var reply = client.InvokeAsync <string>("DelegateFunction", 1, "abc").Result;
                    reply.Should().Be("abc");
                }

                called.Should().BeTrue();
            }
        }