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); }
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)); }
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); }
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); }
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); }