Exemplo n.º 1
0
        public void BasicRoundTrip()
        {
            var    serializer = new JsonCommonSerializer();
            int    port = -1;
            Poller client = null, server = null;
            var    serverThread = RunServer <IMyService>(serializer, p => port = p, p => server = p, new MyService());

            while (port == -1)
            {
                Thread.Yield();
            }
            IMyService proxy        = null;
            var        clientThread = RunClient <IMyService>(serializer, port, p => client = p, p => proxy = p);

            while (proxy == null)
            {
                Thread.Yield();
            }

            var result = proxy.Add(3, 4).Result;

            Assert.Equal(7, result);

            client.CancelAndJoin();
            server.CancelAndJoin();

            clientThread.Wait();
            serverThread.Wait();
        }
Exemplo n.º 2
0
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         Info(proxy.Add(1, 2));
     }
     catch (Exception ex)
     {
         Info(string.Format("There is an issue with MyService: '" + ex.Message + "'"));
     }
 }
 public void PassingTest()
 {
     Assert.Equal(4, myService.Add(2, 2));
 }