예제 #1
0
        public void TestTypeRegistrationExplicit()
        {
            using (new AssertionScope())
                using (var listener = new JsonRpcServer(new MockService()))
                {
                    listener.Register(typeof(RpcTargetMock), "Canary");
                    listener.Register(typeof(RpcTargetMock), "Echo", "Pizza");

                    var registry = listener.GetRegisteredMethods();

                    registry.Should().Contain("Canary");
                    registry.Should().Contain("Pizza");

                    // ReSharper disable once AccessToDisposedClosure
                    Action testAction = () => listener.Register(typeof(RpcTargetMock), "thisIsNotAValidMethod");

                    testAction.Should().Throw <RpcRegistrationException>();
                }
        }
예제 #2
0
        public TestRpcClient()
        {
            var glue = new MockService();

            var listener = new JsonRpcServer(glue);

            listener.Register <RpcTargetMock>();
            listener.Start();

            _client = new JsonRpcClient(glue);
        }
예제 #3
0
        public void TestTypeRegistration()
        {
            using (new AssertionScope())
                using (var listener = new JsonRpcServer(new MockService()))
                {
                    listener.Register(typeof(RpcTargetMock));

                    var registry = listener.GetRegisteredMethods();

                    registry.Should().Contain("Canary");
                }
        }