Пример #1
0
        public void TestNodeEndpointServerStartAndStop()
        {
            EndpointServerCallback        callback = new EndpointServerCallback();
            NodeEndpointServer <Endpoint> server   = new NodeEndpointServer <Endpoint>();

            Assert.AreEqual(NodeEndpointServerState.Ready, server.ServerState);
            server.Start(callback);
            Assert.AreEqual(NodeEndpointServerState.Running, server.ServerState);
            server.Stop();
            Assert.AreEqual(NodeEndpointServerState.Stopped, server.ServerState);
        }
Пример #2
0
        public void TestNodeEndpointServer()
        {
            EndpointServerCallback        callback = new EndpointServerCallback();
            NodeEndpointServer <Endpoint> server   = new NodeEndpointServer <Endpoint>();

            server.Start(callback);

            for (int i = 0; i < 3; i++)
            {
                IEndpoint client = callback.ProtocolFactory.WaitForClient <IEndpoint>("localhost/" + callback.ProtocolAddress, "EndpointService");
                Assert.AreEqual("AB", client.Concat("A", "B"));
                Guid guid = Guid.NewGuid();
                Assert.AreEqual(guid, client.CopyGuid(guid));
                client.Dispose();
            }

            server.Stop();
            Assert.AreEqual(3, callback.endpointStartedCounter);
            Assert.AreEqual(3, callback.endpointStoppedCounter);
        }