public void AdminsCanViewAnyOngoingGameTheyAreNotIn() { 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); SuperUser superUser = authHelper.CreateSuperUser(); client.Login(new AuthorizationRequest() { Password = superUser.password, Username = superUser.userModel.UserModel.Username, }); PlayerCurrentGamesResponse adminGamesResponse = client.GetPlayerCurrentGames(new PlayerCurrentGamesRequest()); Assert.AreEqual(adminGamesResponse.Status.IsSuccess, true); Assert.AreEqual(1, adminGamesResponse.Games.Count); }
public void CannotBlockAnAdmin() { SuperUser admin = authHelper.CreateSuperUser(); var errorResponse = client.BlockPlayer(new BlockPlayerRequest() { UserIdToBlock = admin.DbUserModel.UserModel.Id, }); Assert.AreEqual(errorResponse.Status.IsSuccess, false); Assert.AreEqual(errorResponse.Status.Detail, ResponseType.PERMISSION_DENIED.ToString()); ViewBlockedPlayersResponse blockedUserResponse = client.ViewBlockedPlayers(new ViewBlockedPlayersRequest()); Assert.AreEqual(errorResponse.Status.IsSuccess, true); Assert.AreEqual(0, blockedUserResponse.BlockedUsers.Count); }
public void AdminsCanSeeAllGameEvents() { // Submit 3 close game events, and 2 far game events. SubmitGameEventRequest request = new SubmitGameEventRequest() { EventData = new GameEventRequest() { EventData = ByteString.CopyFromUtf8("MyEventData"), OccursAtTick = 123, }, RoomId = gameId, }; client.SubmitGameEvent(request); client.SubmitGameEvent(request); client.SubmitGameEvent(request); request.EventData.OccursAtTick = 10467; client.SubmitGameEvent(request); client.SubmitGameEvent(request); SuperUser admin = authHelper.CreateSuperUser(); client.Login(new AuthorizationRequest() { Username = admin.DbUserModel.UserModel.Username, Password = admin.password, }); GetGameRoomEventsResponse eventResponse = client.GetGameRoomEvents(new GetGameRoomEventsRequest() { RoomId = gameId, }); Assert.AreEqual(eventResponse.Status.IsSuccess, true); // Admin should be able to see all 5 events! Assert.AreEqual(5, eventResponse.GameEvents.Count); }
public void AdminsCanViewAnyOngoingGameTheyAreNotIn() { var roomId = createRoom(maxPlayers: 2); 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); SuperUser superUser = authHelper.CreateSuperUser(); client.Login(new AuthorizationRequest() { Password = superUser.password, Username = superUser.DbUserModel.UserModel.Username, }); PlayerCurrentGamesResponse adminGamesResponse = client.GetPlayerCurrentGames(new PlayerCurrentGamesRequest()); Assert.AreEqual(adminGamesResponse.Status.IsSuccess, true); Assert.AreEqual(1, adminGamesResponse.Games.Count); }