Exemple #1
0
        public void MethodNameOverrideTest()
        {
            var descriptor = new RpcServiceDescriptor(typeof(IMethodNameOverrideService));
            RpcMethodDescriptor methodDescriptor = descriptor.Methods.First();

            Assert.That(methodDescriptor.Name, Is.EqualTo("DoOtherStuff"));
            Assert.That(methodDescriptor.SyncCallMethod,
                        Is.EqualTo(typeof(IMethodNameOverrideService).GetMethod("DoStuff")));
        }
Exemple #2
0
        public void SimpleMethodTest()
        {
            var descriptor = new RpcServiceDescriptor(typeof(ISimpleService));

            Assert.That(descriptor.Methods.Count(), Is.EqualTo(1));

            RpcMethodDescriptor methodDescriptor = descriptor.Methods.First();

            Assert.That(methodDescriptor.Name, Is.EqualTo("DoStuff"));
            Assert.That(methodDescriptor.SyncCallMethod, Is.EqualTo(typeof(ISimpleService).GetMethod("DoStuff")));
            Assert.That(methodDescriptor.HasAsyncDeclarations, Is.False);
            Assert.That(methodDescriptor.ParameterTypes,
                        Is.EquivalentTo(new[] { typeof(int), typeof(string), typeof(MultiplyInput) }));
            Assert.That(methodDescriptor.ReturnType, Is.EqualTo(typeof(int)));
        }
Exemple #3
0
        public void AsyncServiceTest()
        {
            var descriptor = new RpcServiceDescriptor(typeof(IAsyncService));

            Assert.That(descriptor.Methods.Count(), Is.EqualTo(1));

            RpcMethodDescriptor methodDescriptor = descriptor.Methods.First();

            Assert.That(methodDescriptor.HasAsyncDeclarations, Is.True);
            Assert.That(methodDescriptor.Name, Is.EqualTo("DoStuff"));
            Assert.That(methodDescriptor.SyncCallMethod, Is.EqualTo(typeof(IAsyncService).GetMethod("DoStuff")));
            Assert.That(methodDescriptor.AsyncBeginCallMethod,
                        Is.EqualTo(typeof(IAsyncService).GetMethod("BeginDoStuff")));
            Assert.That(methodDescriptor.AsyncEndCallMethod,
                        Is.EqualTo(typeof(IAsyncService).GetMethod("EndDoStuff")));
        }