Exemplo n.º 1
0
        public void IsUnKnowTestGood_on_Create()
        {
            IUser user = new User(95950052, "orelie", "orelie95950052", "123456789", 0, 500, "*****@*****.**");

            _userDataProxy.AddNewUser(user);
            Assert.IsTrue(user.IsUnKnow());
            _userDataProxy.DeleteUserById(95950052);
        }
        public void Initialize()
        {
            proxy          = new GameDataProxy(gameCenter);
            _userDataProxy = new UserDataProxy();
            user1          = new User(1, "test1", "mo", "1234", 0, 5000, "*****@*****.**");
            user2          = new User(2, "test2", "no", "1234", 0, 5000, "*****@*****.**");
            user3          = new User(3, "test3", "3test", "1234", 0, 5000, "*****@*****.**");
            _userDataProxy.AddNewUser(user1);
            _userDataProxy.AddNewUser(user2);
            _userDataProxy.AddNewUser(user3);
            useCommunication     = false;
            roomID               = 9999;
            players              = new List <Player>();
            player1              = new Player(user1, 1000, roomID);
            player1.RoundChipBet = 22;
            players.Add(player1);
            Decorator deco = SetDecoratoresNoLimitWithSpectatores();

            gameRoom = new GameRoom(players, roomID, deco, gameCenter, logControl, replayManager, ses);
        }
Exemplo n.º 3
0
        public void Initialize()
        {
            proxy          = new GameDataProxy(gameCenter);
            _userDataProxy = new UserDataProxy();
            user1          = new User(1, "test1", "mo", "1234", 0, 5000, "*****@*****.**");
            user2          = new User(2, "test2", "no", "1234", 0, 5000, "*****@*****.**");
            user3          = new User(3, "test3", "3test", "1234", 0, 5000, "*****@*****.**");
            _userDataProxy.AddNewUser(user1);
            _userDataProxy.AddNewUser(user2);
            _userDataProxy.AddNewUser(user3);
            useCommunication     = false;
            roomID               = 9999;
            players              = new List <Player>();
            player1              = new Player(user1, 1000, roomID);
            player1.RoundChipBet = 22;
            players.Add(player1);
            Decorator deco = SetDecoratoresNoLimitWithSpectatores();

            gameRoom = new GameRoom(players, roomID, deco, gameCenter, logControl, replayManager, ses);
            Card        c1     = new Card(Suits.Clubs, 1);
            Card        c2     = new Card(Suits.Clubs, 2);
            List <Card> pCards = new List <Card>();

            pCards.Add(c1);
            pCards.Add(c2);
            long sid = 1;

            msg = new GameDataCommMessage(gameRoom.GetPlayersInRoom().First().user.Id(), gameRoom.Id, sid, new Card(Suits.Diamonds, 1), new Card(Suits.Diamonds, 2),
                                          pCards, 3, 4, new List <string>(), new List <string>(), "", "", "", true, "", "", 1,
                                          new CommunicationMessage.ActionType(), "Flop", "");
            var ob = new List <Tuple <CommunicationMessage, bool, bool, TexasHoldemShared.CommMessages.ServerToClient.ResponeCommMessage> >();

            res = new ResponeCommMessage(1, 1, true, msg);
            var t = new Tuple <CommunicationMessage, bool, bool, TexasHoldemShared.CommMessages.ServerToClient.ResponeCommMessage>(msg, false, false, res);

            ob.Add(t);
            rn = new ResponseNotifier(ob, cl);
        }
Exemplo n.º 4
0
        //register to system - return bool that tell is success or fail - syncronized
        public bool RegisterToSystem(int id, string name, string memberName, string password, int money, string email)
        {
            bool toReturn = false;

            lock (padlock)
            {
                try
                {
                    if (!CanCreateNewUser(id, memberName, password, email))
                    {
                        ErrorLog log = new ErrorLog("Error: while trying register user: onr or more Invalid fields");
                        logControl.AddErrorLog(log);
                        return(toReturn);
                    }
                    if (name.Equals(" ") || name.Equals(""))
                    {
                        ErrorLog log = new ErrorLog("Error: while trying register user: name is empty");
                        logControl.AddErrorLog(log);

                        return(toReturn);
                    }
                    if (!IsValidInputNotSmallerZero(money))
                    {
                        ErrorLog log = new ErrorLog("Error: while trying register user:money smaller than zero");
                        logControl.AddErrorLog(log);

                        return(toReturn);
                    }

                    IUser newUser = new User(id, name, memberName, password, 0, money, email);

                    userProxy.AddNewUser(newUser);
                    // users.Add(newUser);
                    toReturn = true;
                }catch (Exception e)
                {
                    ErrorLog log = new ErrorLog("Error: while trying register user");
                    logControl.AddErrorLog(log);

                    toReturn = false;
                    return(toReturn);
                }

                return(toReturn);
            }
        }
Exemplo n.º 5
0
        private void RegisterUser(int userId)
        {
            IUser toAdd = new User(userId, "orelie", "orelie" + userId, "123456789", 0, 15000, "*****@*****.**");

            _userDataProxy.AddNewUser(toAdd);
        }
Exemplo n.º 6
0
        public void LoginTest()
        {
            UserTable ut = CreateUser(88, "oo5o");

            ut.inActive = false;

            IUser user = ConvertToIUser(ut);

            _userDataProxy.AddNewUser(user);
            _userDataProxy.Login(user);
            Console.WriteLine(user.Id() + user.Name() + user.MemberName() + user.Password() + user.Points() +
                              user.Money() + user.Email() + user.WinNum + 0 + user.HighestCashGainInGame + user.TotalProfit + user.Avatar() +
                              user.GetNumberOfGamesUserPlay() + user.IsLogin() + user.GetLeague());
            IUser t = _userDataProxy.GetUserById(88);

            Console.WriteLine("!!!!Iuserrr  in test password  " + t.Password());
            Assert.IsTrue(t.IsLogin());
            _userDataProxy.DeleteUserById(88);
        }