Пример #1
0
 public bool ReduceMoneyIfPossible(int amount)
 {
     lock (padlock)
     {
         if (money - amount >= 0)
         {
             money -= amount;
             userDataProxy.EditUserMoney(id, money);
             return(true);
         }
         return(false);
     }
 }
Пример #2
0
        public void EditUserMoneyTest()
        {
            UserTable ut = CreateUser(886022005, "EditUserHighestCashGainInGameTest()-proxy");

            _userDataProxy.AddNewUser(ConvertToIUser(ut));
            _userDataProxy.EditUserMoney(886022005, 5000);
            IUser user = _userDataProxy.GetUserById(886022005);

            Assert.AreEqual(user.Money(), 5000);
            _userDataProxy.DeleteUserById(886022005);
        }
Пример #3
0
        //use-case: user can edit is money
        public bool EditMoney(int userId, int newmoney)
        {
            bool  toReturn = false;
            IUser user     = _sc.GetUserWithId(userId);

            if (user == null)
            {
                return(toReturn);
            }
            toReturn = user.EditUserMoney(newmoney);
            if (toReturn)
            {
                _userDataProxy.EditUserMoney(userId, newmoney);
            }
            return(toReturn);
        }