예제 #1
0
        public void ServiceNameDerivedTest()
        {
            var descriptor = new RpcServiceDescriptor(typeof(ISimpleService2));

            Assert.That(descriptor.Name, Is.EqualTo("ISimpleService2"));
            Assert.That(descriptor.Methods.Count(), Is.EqualTo(2));
        }
예제 #2
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")));
        }
예제 #3
0
        public void ServiceNameBaseAttrTest()
        {
            var descriptor = new RpcServiceDescriptor(typeof(ISimpleServiceWithAttr2));

            Assert.That(descriptor.Name, Is.EqualTo("ISimpleServiceWithAttr"));

            //the type with the attribute defines the service, methods from the derived type should be ignored
            Assert.That(descriptor.Methods.Count(), Is.EqualTo(1));
            Assert.That(descriptor.Methods.First().Name, Is.EqualTo("DoStuff"));
        }
예제 #4
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)));
        }
예제 #5
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")));
        }
예제 #6
0
        public void AttrMethodsOnlyTest()
        {
            var descriptor = new RpcServiceDescriptor(typeof(IAttrMethodsOnlyService));

            Assert.That(descriptor.Methods.Count(), Is.EqualTo(1));
        }
예제 #7
0
        public void ServiceNameOverrideTest()
        {
            var descriptor = new RpcServiceDescriptor(typeof(ISimpleServiceNameOverride));

            Assert.That(descriptor.Name, Is.EqualTo("OverriddenName"));
        }
 public void ServiceNameTest()
 {
     var descriptor = new RpcServiceDescriptor(typeof(ISimpleService));
     Assert.That(descriptor.Name, Is.EqualTo("ISimpleService"));
 }
        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)));
        }
 public void ServiceNameDerivedTest()
 {
     var descriptor = new RpcServiceDescriptor(typeof(ISimpleService2));
     Assert.That(descriptor.Name, Is.EqualTo("ISimpleService2"));
     Assert.That(descriptor.Methods.Count(), Is.EqualTo(2));
 }
        public void ServiceNameBaseAttrTest()
        {
            var descriptor = new RpcServiceDescriptor(typeof(ISimpleServiceWithAttr2));
            Assert.That(descriptor.Name, Is.EqualTo("ISimpleServiceWithAttr"));

            //the type with the attribute defines the service, methods from the derived type should be ignored
            Assert.That(descriptor.Methods.Count(), Is.EqualTo(1));
            Assert.That(descriptor.Methods.First().Name, Is.EqualTo("DoStuff"));
        }
 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")));
 }
 public void AttrMethodsOnlyTest()
 {
     var descriptor = new RpcServiceDescriptor(typeof(IAttrMethodsOnlyService));
     Assert.That(descriptor.Methods.Count(), Is.EqualTo(1));
 }
        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")));
        }