public async Task InstanceMethodPair_Invoke_SynchronousMethodAndSimpleMethodParams_ThrowsArgumentNullException() { var methodInfo = typeof(ProxySubject).GetMethod(nameof(ProxySubject.Echo)); var subject = (IProxySubject) new ProxySubject(); var pair = new InstanceMethodPair(subject, methodInfo); IRequest request = null; var response = await pair.InvokeAsync(request); }
public async Task InstanceMethodPair_Invoke_AsynchronousMethodAndSimpleMethodParams_ReturnsNonNullResponse() { var methodInfo = typeof(ProxySubject).GetMethod(nameof(ProxySubject.EchoAsync)); var subject = (IProxySubject) new ProxySubject(); var pair = new InstanceMethodPair(subject, methodInfo); var request = new Request(methodInfo, new object[1] { ProxySubject.EchoValueConst }, Constants.OrganizationId, Constants.InstanceId, Constants.MessageReplyPath); var response = await pair.InvokeAsync(request); Assert.IsNotNull(response); }
public async Task InstanceMethodPair_Invoke_SynchronousMethodAndSimpleMethodParams_ReturnsCorrectResponse() { var methodInfo = typeof(ProxySubject).GetMethod(nameof(ProxySubject.Echo)); var subject = (IProxySubject) new ProxySubject(); var pair = new InstanceMethodPair(subject, methodInfo); var request = new Request(methodInfo, new object[1] { ProxySubject.EchoValueConst }, Constants.OrganizationId, Constants.InstanceId, Constants.MessageReplyPath); var response = await pair.InvokeAsync(request); Assert.AreEqual(request.CorrelationId, response.CorrelationId); Assert.AreEqual(request.Id, response.RequestId); Assert.AreEqual(ProxySubject.EchoValueConst, response.ReturnValue); Assert.AreEqual(ProxySubject.EchoValueConst, response.GetTypedReturnValue <string>()); }