public void spectateSuccessTest() { object m = sl.spectateActiveGame(db.getUserByName("test2").id, 0); Assert.IsInstanceOfType(m, typeof(TexasHoldemGame)); Assert.AreEqual(((TexasHoldemGame)m).spectators.Count, 1); }
public void joinFailsAlreadySpectatingTest() { sl.spectateActiveGame(db.getUserByName("test0").id, 2); object m = sl.GetGameForPlayers(db.getUserByName("test0").id, 2); Assert.AreEqual(m, null); }
private static void SpectateActiveGame(ClientInfo clientInfo, JObject jsonObject) { var gameIdToken = jsonObject["gameId"]; var userIdToken = jsonObject["userId"]; if ((gameIdToken == null) || (gameIdToken.Type != JTokenType.Integer) || (userIdToken == null) || (userIdToken.Type != JTokenType.Integer)) { throw new ArgumentException("Error: Parameters Mismatch at Spectate Active Game"); } var spectateActiveGameResponse = sl.spectateActiveGame((int)userIdToken, (int)gameIdToken); SendMessage(clientInfo, spectateActiveGameResponse); return; }
public object spectateActiveGame(int userId, int gameId) { return(sl.spectateActiveGame(userId, gameId)); }