void PerformAddUser(string username) { message = "Finding user..."; ButtonEnabled = false; KiiUser.FindUserByUserName(username, (KiiUser user, Exception e) => { if (e != null) { ButtonEnabled = true; message = "Failed to find user " + e.Message; return; } message = "Adding user...."; currentGroup.AddUser(user); currentGroup.Save((KiiGroup group, Exception e2) => { ButtonEnabled = true; if (e2 != null) { message = "Failed to add user " + e.ToString(); return; } message = "Add user succeeded"; }); }); }
public void Test_0001_findByUsername_server_error() { this.LogIn(); // set Response client.AddResponse(new CloudException(404, "{}")); KiiUser.FindUserByUserName("user1234"); }
public void Test_0004_findByUsername_invalid() { this.LogIn(); // set Response this.SetStandardFindResponse(client); KiiUser.FindUserByUserName("ab"); }
public void Test_0003_findByUsername_null() { this.LogIn(); // set Response this.SetStandardFindResponse(client); KiiUser.FindUserByUserName(null); }
public void Test_0002_findByUsername_broken_json() { this.LogIn(); // set Response client.AddResponse(200, "broken"); KiiUser.FindUserByUserName("user1234"); }
public void Test_0000_findByUsername() { this.LogIn(); // set Response this.SetStandardFindResponse(client); KiiUser user = KiiUser.FindUserByUserName("user1234"); Assert.AreEqual("a7784f94-3134-4a78-82af-75df87f23873", user.ID); Assert.AreEqual("Test003", user.Username); Assert.AreEqual("Person Test003", user.Displayname); }
void PerformFindByUsername(string username) { message = "Find user by username..."; ButtonEnabled = false; KiiUser.FindUserByUserName(username, (KiiUser user, Exception e) => { ButtonEnabled = true; if (e != null) { message = "Failed to find user " + e.ToString(); return; } message = "User found " + user.Uri.ToString(); }); }
public void Test_0004_findByUsername_invalid() { this.LogIn(); // set Response this.SetStandardFindResponse(); KiiUser found = null; Exception exp = null; KiiUser.FindUserByUserName("ab", (KiiUser u, Exception e) => { found = u; exp = e; }); Assert.IsNull(found); Assert.IsInstanceOfType(typeof(ArgumentException), exp); }
public void Test_0002_findByUsername_broken_json() { this.LogIn(); // set Response client.AddResponse(200, "broken"); KiiUser found = null; Exception exp = null; KiiUser.FindUserByUserName("user1234", (KiiUser u, Exception e) => { found = u; exp = e; }); Assert.IsNull(found); Assert.IsInstanceOfType(typeof(IllegalKiiBaseObjectFormatException), exp); }
public void Test_0001_findByUsername_server_error() { this.LogIn(); // set Response client.AddResponse(new CloudException(404, "{}")); KiiUser found = null; Exception exp = null; KiiUser.FindUserByUserName("user1234", (KiiUser u, Exception e) => { found = u; exp = e; }); Assert.IsNull(found); Assert.IsInstanceOfType(typeof(CloudException), exp); }
public void Test_0000_findByUsername() { this.LogIn(); // set Response this.SetStandardFindResponse(); KiiUser found = null; Exception exp = null; KiiUser.FindUserByUserName("user1234", (KiiUser u, Exception e) => { found = u; exp = e; }); Assert.AreEqual("a7784f94-3134-4a78-82af-75df87f23873", found.ID); Assert.AreEqual("Test003", found.Username); Assert.AreEqual("Person Test003", found.Displayname); Assert.IsNull(exp); }