Пример #1
0
        public void JoinGameWithLobby()
        {
            string roomName = CreateRandomRoomName();

            TestClient client = this.InitClient();

            OperationRequest request = new OperationRequest((short)OperationCodes.Join);

            request.Params.Add((short)ParameterKeys.GameId, roomName);
            request.Params.Add((short)LiteLobby.Operations.LobbyParameterKeys.LobbyId, "Mainlobby");
            client.SendOperationRequest(request, 0, true);
            OperationResponse      response  = client.WaitForOperationResponse(this.WaitTime);
            EventReceivedEventArgs eventArgs = client.WaitForEvent(this.WaitTime);

            // check operation params
            CheckDefaultOperationParams(response, OperationCodes.Join);
            CheckParam(response, ParameterKeys.ActorNr, 1);

            // check event params
            CheckDefaultEventParams(eventArgs, OperationCodes.Join, 1);
            CheckEventParamExists(eventArgs, ParameterKeys.Actors);

            // cleanup
            client.Close();
            client.Dispose();
        }
Пример #2
0
        public void JoinGameWithLobby()
        {
            string roomName = CreateRandomRoomName();

            TestClient client = this.InitClient();

            var request = new OperationRequest {
                OperationCode = (byte)OperationCode.Join, Parameters = new Dictionary <byte, object>()
            };

            request.Parameters.Add((byte)ParameterKey.GameId, roomName);
            request.Parameters.Add((byte)LobbyParameterKeys.LobbyId, "Mainlobby");
            client.SendOperationRequest(request);
            OperationResponse response  = client.WaitForOperationResponse(this.WaitTime);
            EventData         eventArgs = client.WaitForEvent(this.WaitTime);

            // check operation params
            CheckDefaultOperationParameters(response, OperationCode.Join);
            CheckParam(response, ParameterKey.ActorNr, 1);

            // check event params
            CheckDefaultEventParameters(eventArgs, OperationCode.Join, 1);
            CheckEventParamExists(eventArgs, ParameterKey.Actors);

            // cleanup
            client.Close();
            client.Dispose();
        }