public void UpdateByDeletedPseudoUserTest_Async() { CountDownLatch cd = new CountDownLatch(1); Exception e = null; KiiUser.RegisterAsPseudoUser(null, (KiiUser registeredUser, Exception e1) => { string currentUserId = Kii.CurrentUser.ID; string currentUserAccessToken = KiiUser.AccessToken; KiiUser.CurrentUser.Delete(); Kii.CurrentUser = KiiUser.GetById(currentUserId); KiiCloudEngine.UpdateAccessToken(currentUserAccessToken); UserFields userFields = new UserFields(); userFields.Displayname = "disp"; userFields.Country = "JP"; userFields["age"] = 30; userFields.RemoveFromServer("birthday"); Kii.CurrentUser.Update(null, userFields, (KiiUser updatedUser, 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(ForbiddenException), e); }
public void PutIdentityByDeletedUserTest_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.RegisterAsPseudoUser(null, (KiiUser registeredUser, Exception e1) => { IdentityData.Builder builder = IdentityData.Builder.CreateWithName(username); builder.WithEmail(email); builder.WithPhone(phone); IdentityData identityData = builder.Build(); string currentUserId = Kii.CurrentUser.ID; string currentUserAccessToken = KiiUser.AccessToken; KiiUser.CurrentUser.Delete(); Kii.CurrentUser = KiiUser.GetById(currentUserId); KiiCloudEngine.UpdateAccessToken(currentUserAccessToken); Kii.CurrentUser.PutIdentity(identityData, null, "123ABC", (KiiUser user, 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(ForbiddenException), e); }
public void UpdateByDeletedPseudoUserTest() { KiiUser.RegisterAsPseudoUser(null); UserFields userFields = new UserFields(); userFields.Displayname = "disp"; userFields.Country = "JP"; userFields["age"] = 30; userFields.RemoveFromServer("birthday"); string currentUserId = Kii.CurrentUser.ID; string currentUserAccessToken = KiiUser.AccessToken; KiiUser.CurrentUser.Delete(); Kii.CurrentUser = KiiUser.GetById(currentUserId); KiiCloudEngine.UpdateAccessToken(currentUserAccessToken); KiiUser.CurrentUser.Update(userFields); }
public void PutIdentityByDeletedUserTest() { string unixTime = CurrentTimeMillis().ToString(); string username = "******" + unixTime; string email = username + "@kii.com"; string phone = "+874" + unixTime.Substring(unixTime.Length - 9, 9); KiiUser.RegisterAsPseudoUser(null); IdentityData.Builder builder = IdentityData.Builder.CreateWithName(username); builder.WithEmail(email); builder.WithPhone(phone); IdentityData identityData = builder.Build(); string currentUserId = Kii.CurrentUser.ID; string currentUserAccessToken = KiiUser.AccessToken; KiiUser.CurrentUser.Delete(); Kii.CurrentUser = KiiUser.GetById(currentUserId); KiiCloudEngine.UpdateAccessToken(currentUserAccessToken); KiiUser.CurrentUser.PutIdentity(identityData, null, "123ABC"); }