public void successTest() { object m = sl.Register("Scorpion", "GET OVER HERE!!", "*****@*****.**", null); Assert.IsInstanceOfType(m, typeof(SystemUser)); Assert.AreEqual(((SystemUser)m).name, "Scorpion"); db.deleteUser(db.getUserByName("Scorpion").id); }
public void successRegisterTest() { object m = sl.Register("crash bandicoot", "green boxes are the worst", "*****@*****.**", null); Assert.IsInstanceOfType(m, typeof(SystemUser)); Assert.AreEqual(((SystemUser)m).name, "crash bandicoot"); db.deleteUser(db.getUserByName("crash bandicoot").id); }
public void logOutTest() { object objUser = sl.Register("rick roll", "never gonna give you up", "*****@*****.**", null); Assert.IsInstanceOfType(objUser, typeof(SystemUser)); SystemUser user = (SystemUser)objUser; object m = sl.Logout(user.id); Assert.IsInstanceOfType(m, typeof(ReturnMessage)); Assert.IsTrue(((ReturnMessage)m).success); db.deleteUser(user.id); }
private static void Register(ClientInfo clientInfo, JObject jsonObject) { var usernameToken = jsonObject["username"]; var passwordToken = jsonObject["password"]; var emailToken = jsonObject["email"]; var userImageToken = jsonObject["userImage"]; var passPhraseToken = jsonObject["passPhrase"]; if ((usernameToken == null) || (usernameToken.Type != JTokenType.String) || (String.IsNullOrWhiteSpace(usernameToken.ToString())) || (passwordToken == null) || (passwordToken.Type != JTokenType.String) || (String.IsNullOrWhiteSpace(passwordToken.ToString())) || (emailToken == null) || (emailToken.Type != JTokenType.String) || (String.IsNullOrWhiteSpace(emailToken.ToString())) || (userImageToken == null) || (userImageToken.Type != JTokenType.String) || ((((byte[])userImageToken).Length) == 0)) { throw new ArgumentException("Error: Parameters Mismatch at Register", "Register"); } if ((passPhraseToken != null) && (passPhraseToken.Type == JTokenType.String) && (!String.IsNullOrWhiteSpace(passPhraseToken.ToString()))) { if (clientInfo.type == ClientInfo.CLIENT_TYPE.TCP) { clientInfo.passPhrase = (string)passPhraseToken; } } var registerResponse = sl.Register( (string)usernameToken, (string)passwordToken, (string)emailToken, (Bitmap)((new ImageConverter()).ConvertFrom((byte[])userImageToken))); SendMessage(clientInfo, registerResponse, 200, true); return; }
public object register(string username, string password, string email, System.Drawing.Image picture) { return(sl.Register(username, password, email, picture)); }