public void StateTest() { IDXEndpoint endpoint = DXEndpoint.Create(); Assert.True(endpoint.State == DXEndpointState.Connected || endpoint.State == DXEndpointState.Connecting); endpoint.Disconnect(); Assert.AreEqual(endpoint.State, DXEndpointState.NotConnected); endpoint.Connect(demoServerAddress); Assert.True(endpoint.State == DXEndpointState.Connected || endpoint.State == DXEndpointState.Connecting); endpoint.Close(); Assert.AreEqual(endpoint.State, DXEndpointState.Closed); endpoint.Connect(demoServerAddress); Assert.AreEqual(endpoint.State, DXEndpointState.Closed); }
public void CloseTest() { isFiresOnClosing = false; IDXEndpoint endpoint = DXEndpoint.Create(); endpoint.OnClosing += Endpoint_OnClosing; Assert.True(endpoint.State == DXEndpointState.Connected || endpoint.State == DXEndpointState.Connecting); endpoint.Close(); Assert.AreEqual(endpoint.State, DXEndpointState.Closed); Assert.True(isFiresOnClosing); endpoint.Connect(demoServerAddress); Assert.AreEqual(endpoint.State, DXEndpointState.Closed); endpoint.Disconnect(); Assert.AreEqual(endpoint.State, DXEndpointState.Closed); }