Exemplo n.º 1
0
        public async Task TestConnect_ConnectOverAllLocalIpAddresses_ExpectAcceptedClientsAreConnected()
        {
            var(vrClient, vrAcceptedClient) =
                await NetworkTestHelper.ConnectTwoClientsAsync <object>();

            try {
                Assert.True(vrAcceptedClient.Connected);
            } finally {
                vrClient.Dispose();
                vrAcceptedClient.Dispose();
            }
        }
Exemplo n.º 2
0
        public async Task TestSend_SendOnePackageFromVrClientToVrServer_ExpectReceivedVrIdOfPackageIsCorrect()
        {
            var dataExpected = NetworkTestHelper.CreateProtoBufTestData();

            var(vrClient, vrAcceptedClient) =
                await NetworkTestHelper.ConnectTwoClientsAsync <ITestProtoContract>();

            try {
                vrClient.Send(dataExpected);

                var dataReceived = vrAcceptedClient.Receive();
                Assert.Equal(dataExpected, dataReceived);
            } finally {
                vrClient.Dispose();
                vrAcceptedClient.Dispose();
            }
        }
Exemplo n.º 3
0
        public async Task TestConnectAllLocalIpV4Addresses_ConnectClientsToServers_ExpectAcceptedClientIsConnected()
        {
            var ipAddrs = GetAllLocalIpAddresses();

            foreach (var ipAddress in ipAddrs.Where(addr => addr.AddressFamily == AddressFamily.InterNetwork))
            {
                var localEp = new IPEndPoint(ipAddress, 0);
                var(vrClient, vrAcceptedClient) =
                    await NetworkTestHelper.ConnectTwoClientsAsync <object>(localEp);

                try {
                    Assert.True(vrClient.Connected);
                    Assert.True(vrAcceptedClient.Connected);
                } finally {
                    vrClient.Dispose();
                    vrAcceptedClient.Dispose();
                }
            }
        }
Exemplo n.º 4
0
        public async Task TestConnect_ConnectClientToServer_ExpectClientIsConnected()
        {
            var(vrClient, unused) = await NetworkTestHelper.ConnectTwoClientsAsync <object>();

            Assert.True(vrClient.Connected);
        }