Exemple #1
0
        async Task <LCUser> SignUp()
        {
            LCUser user = new LCUser {
                Username = Guid.NewGuid().ToString(),
                Password = "******"
            };

            return(await user.SignUp());
        }
Exemple #2
0
    public async Task <LCUser> Register(string username, string password)
    {
        try {
            LCUser user = new LCUser {
                Username = username,
                Password = password
            };
            await user.SignUp();

            IMClient = new LCIMClient(user);
            await IMClient.Open();

            return(user);
        } catch (LCException e) {
            LCUtils.LogException(e);
            throw e;
        }
    }
Exemple #3
0
 private async Task NewUser(string username, string password)
 {
     try {
         await LCUser.Login(username, password);
     } catch (LCException e) {
         if (e.Code == 211)
         {
             LCUser user1 = new LCUser {
                 Username = username,
                 Password = password
             };
             await user1.SignUp();
         }
         else
         {
             throw e;
         }
     }
 }
Exemple #4
0
        public async Task Init()
        {
            user1 = new LCUser {
                Username = Guid.NewGuid().ToString(),
                Password = "******"
            };
            await user1.SignUp();

            user2 = new LCUser {
                Username = Guid.NewGuid().ToString(),
                Password = "******"
            };
            await user2.SignUp();

            user3 = new LCUser {
                Username = Guid.NewGuid().ToString(),
                Password = "******"
            };
            await user3.SignUp();
        }
 public async Task Update()
 {
     for (int i = 0; i < 10; i++)
     {
         int    today    = DateTimeOffset.Now.DayOfYear;
         string username = $"{today}_{i}";
         string password = "******";
         LCUser user;
         try {
             user = await LCUser.Login(username, password);
         } catch (Exception) {
             user = new LCUser {
                 Username = username,
                 Password = password
             };
             await user.SignUp();
         }
         await LCLeaderboard.UpdateStatistics(user, new Dictionary <string, double> {
             { leaderboardName, i * 10 }
         });
     }
 }
Exemple #6
0
        public async Task SignUp()
        {
            LCUser user     = new LCUser();
            long   unixTime = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();

            user.Username = $"{unixTime}";
            user.Password = "******";
            string email = $"{unixTime}@qq.com";

            user.Email = email;
            string mobile = $"{unixTime / 100}";

            user.Mobile = mobile;
            await user.SignUp();

            TestContext.WriteLine(user.Username);
            TestContext.WriteLine(user.Password);

            Assert.NotNull(user.ObjectId);
            TestContext.WriteLine(user.ObjectId);
            Assert.NotNull(user.SessionToken);
            TestContext.WriteLine(user.SessionToken);
            Assert.AreEqual(user.Email, email);
        }