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"); } }
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>(); } }