예제 #1
0
        public async Task ProxyClient_TransmitAsync()
        {
            var client       = ProxyClient_Constructor();
            var request      = RequestTests.CreateControlEchoRequest();
            var requestCount = Constants.QueueSimulator.RequestCount;
            await client.TransmitAsync(request);

            Assert.IsTrue(Constants.QueueSimulator.RequestCount > requestCount);
        }
예제 #2
0
        public async Task ProxyClient_ReceiveAsync_InvokeResult_Result_IsCorrectType()
        {
            var client  = ProxyClient_Constructor();
            var request = RequestTests.CreateControlEchoRequest();
            await client.TransmitAsync(request);

            CompleteRequest(client, request, TimeSpan.FromSeconds(1));
            var invokeResult = await Constants.AsyncCoupler.WaitOnAsync(request.CorrelationId, TimeSpan.FromSeconds(5));

            Assert.IsInstanceOfType(invokeResult.Result, typeof(IResponse));
        }
예제 #3
0
        public async Task ProxyClient_ReceiveAsync_InvokeResult_Success()
        {
            var client  = ProxyClient_Constructor();
            var request = RequestTests.CreateControlEchoRequest();
            await client.TransmitAsync(request);

            CompleteRequest(client, request, TimeSpan.FromSeconds(1));
            var invokeResult = await Constants.AsyncCoupler.WaitOnAsync(request.CorrelationId, TimeSpan.FromSeconds(5));

            Assert.IsTrue(invokeResult.Successful);
        }
예제 #4
0
        public async Task ProxyClient_ReceiveAsync_Response_ExpectedValues()
        {
            var client  = ProxyClient_Constructor();
            var request = RequestTests.CreateControlEchoRequest();
            await client.TransmitAsync(request);

            CompleteRequest(client, request, TimeSpan.FromSeconds(1));
            var invokeResult = await Constants.AsyncCoupler.WaitOnAsync(request.CorrelationId, TimeSpan.FromSeconds(5));

            var response = (IResponse)invokeResult.Result;

            Assert.AreEqual(request.CorrelationId, response.CorrelationId);
            Assert.AreEqual(ProxySubject.EchoValueConst, response.ReturnValue);
        }
예제 #5
0
        public async Task RequestBroker_Invoke()
        {
            IProxySubject controlInstance = new ProxySubject();

            var broker            = new RequestBroker();
            var methodsRegistered = broker.AddService(controlInstance);
            var request           = RequestTests.CreateControlEchoRequest();

            var response = await broker.InvokeAsync(request);

            Assert.AreEqual(true, response.Success);
            Assert.AreEqual(request.CorrelationId, response.CorrelationId);
            Assert.AreEqual(request.Id, response.RequestId);
            Assert.AreEqual(ProxySubject.EchoValueConst, response.ReturnValue);
        }