/// <summary> /// The leave clients from room. /// </summary> /// <param name = "client1"> /// The client 1. /// </param> /// <param name = "client2"> /// The client 2. /// </param> protected void LeaveClientsFromRoom(TestClient client1, TestClient client2) { var request = new OperationRequest { OperationCode = (byte)OperationCode.Leave, Parameters = new Dictionary<byte, object>() }; client1.SendOperationRequest(request); OperationResponse response = client1.WaitForOperationResponse(this.WaitTime); CheckDefaultOperationParameters(response, OperationCode.Leave); if (client2 != null) { EventData eventArgs2 = client2.WaitForEvent(this.WaitTime); CheckDefaultEventParameters(eventArgs2, OperationCode.Leave, 1); client2.SendOperationRequest(request); response = client2.WaitForOperationResponse(this.WaitTime); CheckDefaultOperationParameters(response, OperationCode.Leave); } }
/// <summary> /// The join clients to room. /// </summary> /// <param name = "roomName"> /// The room name. /// </param> /// <param name = "client1"> /// The client 1. /// </param> /// <param name = "client2"> /// The client 2. /// </param> /// <param name = "clientProperties1"> /// The client properties 1. /// </param> /// <param name = "clientProperties2"> /// The client properties 2. /// </param> /// <param name = "broadcastClientProperties"> /// The broadcast client properties. /// </param> protected void JoinClientsToRoom( string roomName, TestClient client1, TestClient client2, Hashtable clientProperties1, Hashtable clientProperties2, bool broadcastClientProperties) { // send join operation for client one OperationRequest request = CreateJoinRequest(roomName, clientProperties1, broadcastClientProperties); client1.SendOperationRequest(request); // wait for operation response and join event OperationResponse response = client1.WaitForOperationResponse(this.WaitTime); EventData eventArgs1 = client1.WaitForEvent(this.WaitTime); // check operation response CheckJoinResponse(response, 1); // check join event Hashtable expectedActorProperties = broadcastClientProperties ? clientProperties1 : null; CheckJoinEvent(eventArgs1, 1, expectedActorProperties); if (client2 != null) { // send join operation for client two request = CreateJoinRequest(roomName, clientProperties2, broadcastClientProperties); client2.SendOperationRequest(request); // wait for operation response and join events response = client2.WaitForOperationResponse(this.WaitTime); eventArgs1 = client1.WaitForEvent(this.WaitTime); EventData eventArgs2 = client2.WaitForEvent(this.WaitTime); // check operation response CheckJoinResponse(response, 2); // check join events expectedActorProperties = broadcastClientProperties ? clientProperties2 : null; CheckJoinEvent(eventArgs1, 2, expectedActorProperties); CheckJoinEvent(eventArgs2, 2, expectedActorProperties); } }