public void PlaceClientBet_UserIsAbleToPlaceCertainBet_BetIsPlacedReturnTrue()
        {
            //Arrange
            CreateUserinDatabase();
            var moneyTransfer  = 10M;
            var betValue       = 10M;
            var dogToWin       = 1;
            var isStandard     = true;
            var manageUserData = new ManageUserData();
            var loadUserData   = new LoadUserData();

            //Action
            //Add client to dictionary because all manageUserData methods relay on it.
            loadUserData.AddClientToList(connectionId, username);
            //Transfer money to client account that he is able to place given bet.
            manageUserData.AddCashToClientAccount(connectionId, moneyTransfer);
            //Get the result if bet has been placed.
            var result = manageUserData.PlaceClientBet(connectionId, betValue, dogToWin, isStandard);

            //Assert
            Assert.IsTrue(result);

            //Delete recently added player in database to avoid conflicts with further tests.
            DeleteUserFromDatabase(username);
        }
Beispiel #2
0
    // Use this for initialization
    void Awake()
    {
        cities = new List <City>();
        ins    = this;

        cityData = Resources.Load <TextAsset> ("cityData");

        string[] data = cityData.text.Split(new char[] { '\n' });

        for (int i = 1; i < data.Length - 1; i++)
        {
            string[] row  = data [i].Split(new char[] { ',' });
            City     city = new City();
            city.name       = row [0];
            city.city_ascii = row [1];
            float.TryParse(row [2], out city.lat);
            float.TryParse(row [3], out city.lng);
            int.TryParse(row [4], out city.pop);
            city.country  = row [5];
            city.iso2     = row [6];
            city.iso3     = row [7];
            city.province = row [8];

            cities.Add(city);
        }
    }
        public bool checkUser(string email, string pass)
        {
            loadUser = new LoadUserData();
            bool   result    = false;
            string passCheck = loadUser.getPassword(email);

            if (string.IsNullOrEmpty(passCheck))
            {
                MessageBox.Show("Email Does Not Exist");
            }
            else
            {
                passCheck = passCheck.Replace(" ", "");
                //MessageBox.Show(passCheck.Length.ToString());
                if (pass.Equals(passCheck))
                {
                    result  = true;
                    logedin = true;
                }
                else
                {
                    result = false;
                }
            }
            return(result);
        }
Beispiel #4
0
        public void AddClientToList_ClientDictionaryIsEmptyOrClientIsNotInDictionary_CLientIsAddedToDictionaryReturnTrue()
        {
            //Arrange
            CreateUserinDatabase();
            var loadUserData = new LoadUserData();
            var result       = loadUserData.AddClientToList(connectionId, username);

            //Assert
            Assert.IsTrue(result);

            //Delete recently added player in database to avoid conflicts with further tests.
            DeleteUserFromDatabase(username);
        }
Beispiel #5
0
        public void AddCLientToList_ClientIsAlreadyInDictionary_ClientIsNotAddedReturnFalse()
        {
            //Arrange
            CreateUserinDatabase();
            var loadUserData          = new LoadUserData();
            var randomStringGenerator = new RandomStringGenerator();
            var fakeConnectionId      = randomStringGenerator.GenerateRandomString();

            //Add recently created user to dictionary.
            loadUserData.AddClientToList(connectionId, username);
            //Try to add user with same username.
            var result = loadUserData.AddClientToList(fakeConnectionId, username);

            //Assert
            Assert.IsFalse(result);

            //Delete recently added player in database to avoid conflicts with further tests.
            DeleteUserFromDatabase(username);
        }
Beispiel #6
0
    void AppricationAwake()
    {
        DontDestroyOnLoad (this);
        load = GetComponent<LoadUserData> ();
        save = GetComponent<SaveUserData> ();
        string timestring = PlayerPrefs.GetString("lasttime");
        // 初回起動時は取得できないので代わりに現在の時刻を入れる
        if (timestring == null || timestring == "") timestring = System.DateTime.Now.ToString();
        // 保存しておいた時刻は文字列なので時刻(DateTime)に変換
        System.DateTime datetime = System.DateTime.Parse(timestring);
        // 現在の時刻-保存しておいた時刻で経過時間を求める
        System.TimeSpan span = System.DateTime.Now - datetime;
        // 経過時間を秒で取得
        spantime = span.TotalSeconds;
        // spantimeでスタミナの回復分を求める

        timestring = "0";
        PlayerPrefs.SetString("lasttime",timestring);
        Debug.Log (spantime);
    }
        public void PlaceClientBet_UserCanNotPlaceCertainBet_BetIsNotPlacedReturnFalse()
        {
            //Arrange
            CreateUserinDatabase();
            var betValue       = 10M;
            var dogToWin       = 1;
            var isStandard     = true;
            var manageUserData = new ManageUserData();
            var loadUserData   = new LoadUserData();

            //Action
            //Add client to dictionary because all manageUserData methods relay on it.
            loadUserData.AddClientToList(connectionId, username);
            //Get the result if bet has been placed. User tries to place bet with 0 cash on his account.
            var result = manageUserData.PlaceClientBet(connectionId, betValue, dogToWin, isStandard);

            //Assert
            Assert.IsFalse(result);

            //Delete recently added player in database to avoid conflicts with further tests.
            DeleteUserFromDatabase(username);
        }
        public void AddCashToClientAccount_ClientTransfersCertainAmountOfCash_HisAccountBalanceIsUpdated()
        {
            //Arrange
            CreateUserinDatabase();
            var moneyTransfer  = 100M;
            var manageUserData = new ManageUserData();
            var loadUserData   = new LoadUserData();
            var database       = new DataClassesBettingParlorDataContext();

            //Action
            //Add client to dictionary because all manageUserData methods relay on it.
            loadUserData.AddClientToList(connectionId, username);
            manageUserData.AddCashToClientAccount(connectionId, moneyTransfer);
            decimal accountBalanceAfterTransfer = database.Players.SingleOrDefault(p => p.UserName == username).CurrentAccountBalance;

            //Assert
            //New user is created so after transfer his accountBalance must equal the amount he transfered.
            Assert.AreEqual(moneyTransfer, accountBalanceAfterTransfer);

            //Delete recently added player in database to avoid conflicts with further tests.
            DeleteUserFromDatabase(username);
        }
Beispiel #9
0
 private void LoadData()
 {
     Users    = LoadUserData.LoadDataOfUsers(separatorForUsers, UsersFilePath).ToList();
     Products = LoadProductData.LoadDataOfProducts(separatorForProducts, productsFilePath).ToList();
 }
Beispiel #10
0
 // Use this for initialization
 void Awake()
 {
     //ユーザーデータを読み込み
     load = GetComponent<LoadUserData> ();
     load.loadUserData ();
 }
 public AuthenticationCheck()
 {
     loadUser = new LoadUserData();
 }