Esempio n. 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));
        }
Esempio n. 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")));
        }
Esempio n. 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"));
        }
Esempio n. 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)));
        }
Esempio n. 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")));
        }
Esempio n. 6
0
        public void AttrMethodsOnlyTest()
        {
            var descriptor = new RpcServiceDescriptor(typeof(IAttrMethodsOnlyService));

            Assert.That(descriptor.Methods.Count(), Is.EqualTo(1));
        }
Esempio n. 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")));
        }