예제 #1
0
        public void before()
        {
            //  gc = GameCenter.GameCenterFactory.getInstance();
            if (GameCenterService.testable)
            {
                gc = new GameCenterService();
            }
            else
            {
                gc = new GameCenterStub();
            }
            us    = new SystemService();
            prefs = new GamePreferences(8, 2, 5, 10, 1, 20, 3, true);
            UserProfile ohadUser = new UserProfile("ohad", "213");

            us.register(ohadUser.Username, "213");
            gc.createGame(prefs, ohadUser.Username);
            prefs = new GamePreferences(8, 2, 5, 10, 1, 20, 3, false);
            gc.createGame(prefs, ohadUser.Username);

            //us = new SystemService();
            us.register("abc", "123");
            us.login("abc", "123");

            us.register("abc2", "123");
            us.login("abc2", "123");

            us.register("abc3", "123");
            us.login("abc3", "123");
        }
예제 #2
0
        public void Valid_createGame()
        {
            GamePreferences prefs = new GamePreferences(8, 2, 5, 10, 1, 2, 3, true);

            // ClientUserProfile ohadUser = new ClientUserProfile (new UserProfile("ohad", "213"));
            us.login("ohad", "213");
            gc.createGame(prefs, "ohad");
            Assert.AreEqual(gc.getActiveGames("preferences", prefs, "ohad").Count(), 1);
            us.logout("ohad");
        }
예제 #3
0
        public void joinGameTest()
        {
            pref = new GamePreferences(8, 2, 5, 10, 1, 2, 3, true);
            ClientGame game = gc.createGame(pref, username);

            Assert.AreEqual(0, game.Players.Count);

            List <String> users = gc.joinGame(game.getID(), username, 50);

            Assert.AreEqual(1, users.Count);
            Assert.True(users.Contains(us.getUser(username).Username));
        }