Ejemplo n.º 1
0
        public void unbind()
        {
            var       loggerMock    = AutoMockContainer.GetMock <ILogger <RpcServer> >();
            var       aclLoaderMock = AutoMockContainer.GetMock <INetworkAclLoader>();
            RpcServer rpcServer     = new RpcServer(GetRpcConfig(), loggerMock.Object, aclLoaderMock.Object);

            // binding

            rpcServer.BindOperation(null, "checkDifferent", new Func <int, string, bool>((a, b) =>
            {
                int.TryParse(b, out var bInt);
                return(!bInt.Equals(a));
            }));
            rpcServer.BindController <Foo>();

            // unbinding

            rpcServer.UnbindController("Foo");

            // calling

            var resp = (bool)rpcServer.CallOperation(null, null, "checkDifferent", 2, "2");

            Assert.IsFalse(resp);

            rpcServer.CallOperation(null, "Foo", "Bar");
        }