Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        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>());
        }