Пример #1
0
        public void BeingTheLastPlayerToJoinAGameWillStartTheGame()
        {
            CreateRoomResponse roomResponse = client.CreateNewRoom(createRoomRequest("My room!", maxPlayers: 2));

            Assert.AreEqual(roomResponse.Status.IsSuccess, true);
            Assert.IsTrue(roomResponse.CreatedRoom.Id != null);
            var roomId = roomResponse.CreatedRoom.Id;

            authHelper.loginToAccount("userTwo");

            JoinRoomRequest joinRequest = new JoinRoomRequest()
            {
                RoomId = roomId,
            };

            JoinRoomResponse joinResponse = client.JoinRoom(joinRequest);

            Assert.AreEqual(joinResponse.Status.IsSuccess, true);

            // Check to see the room is not visible.
            OpenLobbiesResponse openLobbiesResponseAfterJoin = client.GetOpenLobbies(new OpenLobbiesRequest());

            Assert.AreEqual(openLobbiesResponseAfterJoin.Status.IsSuccess, true);
            Assert.AreEqual(0, openLobbiesResponseAfterJoin.Rooms.Count);

            // Check to see the player can see the game because they are a member.
            PlayerCurrentGamesResponse playerGamesResponse = client.GetPlayerCurrentGames(new PlayerCurrentGamesRequest());

            Assert.AreEqual(playerGamesResponse.Status.IsSuccess, true);
            Assert.AreEqual(1, playerGamesResponse.Games.Count);
        }
Пример #2
0
        public void BeingTheLastPlayerToJoinAGameWillStartTheGame()
        {
            CreateRoomRequest createRequest = new CreateRoomRequest()
            {
                Anonymous          = false,
                Goal               = Goal.Domination,
                MaxPlayers         = 2,
                IsRanked           = false,
                RoomName           = "My Room!",
                AllowedSpecialists = { "a", "b", "c" },
            };

            CreateRoomResponse roomResponse = client.CreateNewRoom(createRequest);

            Assert.AreEqual(roomResponse.Status.IsSuccess, true);
            Assert.IsTrue(roomResponse.CreatedRoom.RoomId != null);
            var roomId = roomResponse.CreatedRoom.RoomId;

            authHelper.loginToAccount("userTwo");

            JoinRoomRequest joinRequest = new JoinRoomRequest()
            {
                RoomId = roomId,
            };

            JoinRoomResponse joinResponse = client.JoinRoom(joinRequest);

            Assert.AreEqual(joinResponse.Status.IsSuccess, true);

            // Check to see the room is not visible.
            OpenLobbiesResponse openLobbiesResponseAfterJoin = client.GetOpenLobbies(new OpenLobbiesRequest());

            Assert.AreEqual(openLobbiesResponseAfterJoin.Status.IsSuccess, true);
            Assert.AreEqual(0, openLobbiesResponseAfterJoin.Rooms.Count);

            // Check to see the player can see the game because they are a member.
            PlayerCurrentGamesResponse playerGamesResponse = client.GetPlayerCurrentGames(new PlayerCurrentGamesRequest());

            Assert.AreEqual(playerGamesResponse.Status.IsSuccess, true);
            Assert.AreEqual(1, playerGamesResponse.Games.Count);
        }