Esempio n. 1
0
        public async Task GeneratedGenericService_GeneratedGenericProxy_Event()
        {
            TestClientServer <GenericDummyTestService> testClientServer = await SetupTestClientServer <GenericDummyTestService>();

            var proxy    = new GenericTestProxy <Dummy, EpoxyConnection>(testClientServer.ClientConnection);
            var theEvent = new Dummy {
                int_value = 100
            };

            ManualResetEventSlim waitForEvent = testClientServer.Service.CreateResetEvent();

            proxy.EventMethodAsync(theEvent);
            bool wasSignaled = waitForEvent.Wait(TimeSpan.FromSeconds(1));

            Assert.IsTrue(wasSignaled, "Timed out waiting for event to fire");

            Assert.AreEqual(0, testClientServer.Service.RequestCount);
            Assert.AreEqual(1, testClientServer.Service.EventCount);
            Assert.AreEqual(theEvent.int_value, testClientServer.Service.LastEventReceived.int_value);
        }
Esempio n. 2
0
        public async Task GeneratedGenericService_GeneratedGenericProxy_PayloadResponse()
        {
            TestClientServer <GenericDummyTestService> testClientServer = await SetupTestClientServer <GenericDummyTestService>();

            var proxy   = new GenericTestProxy <Dummy, EpoxyConnection>(testClientServer.ClientConnection);
            var request = new Dummy {
                int_value = 100
            };
            IMessage <Dummy> response = await proxy.ReqRspMethodAsync(request);

            Assert.IsFalse(response.IsError);
            Assert.AreEqual(101, response.Payload.Deserialize().int_value);

            await testClientServer.ServiceTransport.StopAsync();

            await testClientServer.ClientTransport.StopAsync();

            Assert.AreEqual(1, testClientServer.Service.RequestCount);
            Assert.AreEqual(0, testClientServer.Service.EventCount);
            Assert.AreEqual(request.int_value, testClientServer.Service.LastRequestReceived.int_value);
        }
Esempio n. 3
0
        public async Task GeneratedGenericService_GeneratedGenericProxy_Event()
        {
            TestClientServer<GenericDummyTestService> testClientServer = await SetupTestClientServer<GenericDummyTestService>();
            var proxy = new GenericTestProxy<Dummy, EpoxyConnection>(testClientServer.ClientConnection);
            var theEvent = new Dummy { int_value = 100 };

            ManualResetEventSlim waitForEvent = testClientServer.Service.CreateResetEvent();
            proxy.EventMethodAsync(theEvent);
            bool wasSignaled = waitForEvent.Wait(TimeSpan.FromSeconds(1));
            Assert.IsTrue(wasSignaled, "Timed out waiting for event to fire");

            Assert.AreEqual(0, testClientServer.Service.RequestCount);
            Assert.AreEqual(1, testClientServer.Service.EventCount);
            Assert.AreEqual(theEvent.int_value, testClientServer.Service.LastEventReceived.int_value);

            await testClientServer.ServiceTransport.StopAsync();
            await testClientServer.ClientTransport.StopAsync();
        }
Esempio n. 4
0
        public async Task GeneratedGenericService_GeneratedGenericProxy_PayloadResponse()
        {
            TestClientServer<GenericDummyTestService> testClientServer = await SetupTestClientServer<GenericDummyTestService>();
            var proxy = new GenericTestProxy<Dummy, EpoxyConnection>(testClientServer.ClientConnection);
            var request = new Dummy { int_value = 100 };
            IMessage<Dummy> response = await proxy.ReqRspMethodAsync(request);

            Assert.IsFalse(response.IsError);
            Assert.AreEqual(101, response.Payload.Deserialize().int_value);

            await testClientServer.ServiceTransport.StopAsync();
            await testClientServer.ClientTransport.StopAsync();

            Assert.AreEqual(1, testClientServer.Service.RequestCount);
            Assert.AreEqual(0, testClientServer.Service.EventCount);
            Assert.AreEqual(request.int_value, testClientServer.Service.LastRequestReceived.int_value);
        }