public void PutIdentityByUnnoticedNormalUserTest_Async() { CountDownLatch cd = new CountDownLatch(1); string unixTime = CurrentTimeMillis().ToString(); string username = "******" + unixTime; string email = username + "@kii.com"; string phone = "+874" + unixTime.Substring(unixTime.Length - 9, 9); Exception e = null; KiiUser user = KiiUser.BuilderWithName(username).WithEmail(email).WithPhone(phone).Build(); user.Register("password"); KiiUser unnoticedNormalUser = KiiUser.CreateByUri(user.Uri); IdentityData.Builder builder = IdentityData.Builder.CreateWithName(username); builder.WithEmail(email); builder.WithPhone(phone); IdentityData identityData = builder.Build(); unnoticedNormalUser.PutIdentity(identityData, null, "123ABC", (KiiUser u, Exception e2) => { e = e2; cd.Signal(); }); if (!cd.Wait(new TimeSpan(0, 0, 0, 10))) { Assert.Fail("Callback not fired."); } Assert.IsNotNull(e); Assert.IsInstanceOfType(typeof(AlreadyHasIdentityException), e); }
public void PutIdentityByUnnoticedNormalUserTest() { string unixTime = CurrentTimeMillis().ToString(); string username = "******" + unixTime; string email = username + "@kii.com"; string phone = "+874" + unixTime.Substring(unixTime.Length - 9, 9); KiiUser user = KiiUser.BuilderWithName(username).WithEmail(email).WithPhone(phone).Build(); user.Register("password"); KiiUser unnoticedNormalUser = KiiUser.CreateByUri(user.Uri); IdentityData.Builder builder = IdentityData.Builder.CreateWithName(username); builder.WithEmail(email); builder.WithPhone(phone); IdentityData identityData = builder.Build(); unnoticedNormalUser.PutIdentity(identityData, null, "123ABC"); }