Пример #1
0
        public void PlayerCanStartAGameEarlyIfTwoPlayersAreInTheLobby()
        {
            CreateRoomResponse roomResponse = authHelper.CreateGameRoom("room1");
            var roomId = roomResponse.CreatedRoom.RoomId;

            authHelper.loginToAccount("userTwo");
            JoinRoomResponse joinResponse = client.JoinRoom(new JoinRoomRequest()
            {
                RoomId = roomId,
            });

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


            authHelper.loginToAccount("userOne");
            StartGameEarlyResponse startGameEarlyResponse = client.StartGameEarly(new StartGameEarlyRequest()
            {
                RoomId = roomId,
            });

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

            // Ensure game cannot be seen in open lobbies.
            // View open rooms.
            OpenLobbiesResponse openLobbiesResponse = client.GetOpenLobbies(new OpenLobbiesRequest());

            Assert.AreEqual(openLobbiesResponse.Status.IsSuccess, true);
            Assert.AreEqual(0, openLobbiesResponse.Rooms.Count);
        }
Пример #2
0
        public void PlayerCannotStartAGameEarlyWithNobodyInTheLobby()
        {
            var roomId = createRoom();

            StartGameEarlyResponse startGameEarlyResponse = client.StartGameEarly(new StartGameEarlyRequest()
            {
                RoomId = roomId,
            });

            Assert.AreEqual(startGameEarlyResponse.Status.IsSuccess, false);

            // Ensure game is still open
            // View open rooms.
            OpenLobbiesResponse openLobbiesResponse = client.GetOpenLobbies(new OpenLobbiesRequest());

            assertSuccessResponse(openLobbiesResponse.Status);
            Assert.AreEqual(1, openLobbiesResponse.Rooms.Count);
        }
Пример #3
0
        public void PlayerCannotStartAGameEarlyWithNobodyInTheLobby()
        {
            CreateRoomResponse roomResponse = authHelper.CreateGameRoom("room1");
            var roomId = roomResponse.CreatedRoom.RoomId;

            StartGameEarlyResponse startGameEarlyResponse = client.StartGameEarly(new StartGameEarlyRequest()
            {
                RoomId = roomId,
            });

            Assert.AreEqual(startGameEarlyResponse.Status.IsSuccess, false);

            // Ensure game is still open
            // View open rooms.
            OpenLobbiesResponse openLobbiesResponse = client.GetOpenLobbies(new OpenLobbiesRequest());

            Assert.AreEqual(openLobbiesResponse.Status.IsSuccess, true);
            Assert.AreEqual(1, openLobbiesResponse.Rooms.Count);
        }