public async Task TestConnect_ConnectOverAllLocalIpAddresses_ExpectAcceptedClientsAreConnected() { var(vrClient, vrAcceptedClient) = await NetworkTestHelper.ConnectTwoClientsAsync <object>(); try { Assert.True(vrAcceptedClient.Connected); } finally { vrClient.Dispose(); vrAcceptedClient.Dispose(); } }
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(); } }
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(); } } }
public async Task TestConnect_ConnectClientToServer_ExpectClientIsConnected() { var(vrClient, unused) = await NetworkTestHelper.ConnectTwoClientsAsync <object>(); Assert.True(vrClient.Connected); }