示例#1
0
        public void Setup()
        {
            Server = new LinkServer();
            TestContractInstance = new TestContract();
            Server.RegisterContractImplementation <ITestContract, TestContract>(TestContractInstance);
            Server.Start(8080);

            // Give the server a second to fire up.
            Thread.Sleep(1000);

            Client = new LinkClient();
            Client.Setup("127.0.0.1", 8080);
            TestContract = Client.GetContract <ITestContract>();
        }
示例#2
0
        public async Task ConnectionIdMultipleClients()
        {
            // The connection Id is global, so we don't have a reliable way to check if the value is correct
            // as the connection counter is shared between Server instances.
            Assert.IsNull(TestContractInstance.LatestConnectionId);
            TestContract.SimpleMethod();
            var connId = TestContractInstance.LatestConnectionId;

            Assert.IsNotNull(connId);
            using (var client = new LinkClient())
            {
                client.Setup("127.0.0.1", 8080);
                await Task.Delay(1000);

                client.GetContract <ITestContract>().SimpleMethod();
                await Task.Delay(1000);

                Assert.AreNotEqual(connId, TestContractInstance.LatestConnectionId);
            }
        }