Exemple #1
0
        public void InstanceMethodPair_GetArguments_NullRequest_ThrowsArgumentNullException()
        {
            var      methodInfo = typeof(ProxySubject).GetMethod(nameof(ProxySubject.Echo));
            var      parameters = methodInfo.GetParameters();
            var      subject    = (IProxySubject) new ProxySubject();
            var      pair       = new InstanceMethodPair(subject, methodInfo);
            IRequest request    = null;

            var arguments = InstanceMethodPair.GetArguments(request, parameters);
        }
Exemple #2
0
        public void InstanceMethodPair_GetArguments_Fails_DueToTypeMismatch()
        {
            var methodInfo = typeof(ProxySubject).GetMethod(nameof(ProxySubject.Echo));
            var parameters = methodInfo.GetParameters();
            var request    = new Request(methodInfo, new object[] { 3 }, Constants.OrganizationId, Constants.InstanceId, Constants.MessageReplyPath);

            Assert.AreEqual(1, request.ArgumentCount);
            Assert.AreEqual(1, parameters.Length);

            var arguments = InstanceMethodPair.GetArguments(request, parameters);
        }
Exemple #3
0
        public void InstanceMethodPair_GetArguments_Fails_DueToUnsupportedParamsKeyword()
        {
            var methodInfo = typeof(ProxySubject).GetMethod(nameof(ProxySubject.PassStringParams));
            var parameters = methodInfo.GetParameters();
            var request    = new Request(methodInfo, new object[] { ProxySubject.EchoValueConst }, Constants.OrganizationId, Constants.InstanceId, Constants.MessageReplyPath);

            Assert.AreEqual(1, request.ArgumentCount);
            Assert.AreEqual(1, parameters.Length);

            var arguments = InstanceMethodPair.GetArguments(request, parameters);
        }
Exemple #4
0
        public void InstanceMethodPair_GetArguments_NullParameters_ThrowsArgumentNullException()
        {
            var methodInfo = typeof(ProxySubject).GetMethod(nameof(ProxySubject.Echo));

            ParameterInfo[] parameters = null;
            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 arguments = InstanceMethodPair.GetArguments(request, parameters);
        }
Exemple #5
0
        public void InstanceMethodPair_GetArguments_Succeeds_ReturnsNonNullArguments()
        {
            var methodInfo = typeof(ProxySubject).GetMethod(nameof(ProxySubject.Echo));
            var parameters = methodInfo.GetParameters();
            var request    = new Request(methodInfo, new object[] { ProxySubject.EchoValueConst }, Constants.OrganizationId, Constants.InstanceId, Constants.MessageReplyPath);

            Assert.AreEqual(1, request.ArgumentCount);
            Assert.AreEqual(1, parameters.Length);

            var arguments = InstanceMethodPair.GetArguments(request, parameters);

            Assert.IsNotNull(arguments);
        }