public void AddOption_AddingDuplicateOption_ArgumentException() { Option options = new Option(); options.AddOption("key", 1); options.AddOption("key", 2); }
public void ToString_FewOptions_KeyValuePairsInString() { Option options = new Option(); options.AddOption("baseLinkUrl", "home/getdata"); options.AddOption("id", 5); string expected = "baseLinkUrl: 'home/getdata', id: 5".RemoveSpaces(); string actual = options.ToString().RemoveSpaces(); Assert.AreEqual(expected, actual); }
/// <summary> /// 发送修改密码验证邮件 /// </summary> /// <param name="email"></param> /// <returns></returns> public string SendResetPasswordEmail(string email) { if (email == null || email == "") { throw new AuthingException("email can not be empty!"); } Option option = new Option(); option.AddOption("client", inner.clientId); option.AddOption("email", email); return(inner.SendResetPasswordEmail(option)); }
/// <summary> /// 获取用户列表 /// </summary> /// <param name="pageIndex">页索引</param> /// <param name="pageSize">每页数量</param> /// <returns></returns> public string GetUserList(int pageIndex, int pageSize) { if (pageIndex < 1) { throw new AuthingException("pageIndex can not less than 1 !"); } if (pageSize < 1) { throw new AuthingException("pageIndex can not less than 1 !"); } Option option = new Option(inner.clientId); option.AddOption("page", pageIndex); option.AddOption("count", pageSize); return(inner.Users(option)); }
/// <summary> /// 注册 /// </summary> /// <param name="email">邮箱</param> /// <param name="password">密码</param> /// <returns></returns> public string Register(string email, string password) { if (email == null || email == "") { throw new AuthingException("email can not be empty!"); } if (password == null || password == "") { throw new AuthingException("password can not be empty!"); } Option option = new Option(inner.clientId); option.AddOption("email", email); option.AddOption("password", password); return(inner.Register(option)); }
/// <summary> /// 获取在Authing控制台中配置的OAuth信息 /// </summary> /// <returns></returns> public string ReadOAuthList() { Option option = new Option(); option.AddOption("clientId", inner.clientId); return(inner.ReadOAuthList(option)); }
/// <summary> /// 验证修改密码验证码 /// </summary> /// <param name="email"></param> /// <param name="verifyCode"></param> /// <returns></returns> public string VerifyResetPasswordVerifyCode(string email, string verifyCode) { if (email == null || email == "") { throw new AuthingException("email can not be empty!"); } if (verifyCode == null || verifyCode == "") { throw new AuthingException("verify code can not be empty!"); } Option option = new Option(); option.AddOption("client", inner.clientId); option.AddOption("email", email); option.AddOption("verifyCode", verifyCode); return(inner.VerifyResetPasswordVerifyCode(option)); }
/// <summary> /// 批量删除用户 /// </summary> /// <param name="id">用户ID</param> /// <returns></returns> public string RemoveUsers(string[] ids) { if (ids == null || ids.Length < 1) { throw new AuthingException("user id array can not be empty!"); } Option option = new Option(inner.clientId); option.AddOption("ids", ids); return(inner.RemoveUsers(option)); }
/// <summary> /// 删除用户 /// </summary> /// <param name="id">用户ID</param> /// <returns></returns> public string RemoveUser(string id) { if (id == null || id == "") { throw new AuthingException("user id can not be empty!"); } Option option = new Option(inner.clientId); option.AddOption("ids", new string[] { id }); return(inner.RemoveUsers(option)); }
/// <summary> /// 获取用户信息 /// </summary> /// <param name="id"></param> /// <returns></returns> public string GetUserInfo(string id) { if (id == null || id == "") { throw new AuthingException("user id can not be empty!"); } Option option = new Option(inner.clientId); option.AddOption("id", id); return(inner.User(option)); }
/// <summary> /// 更新用户信息 /// </summary> /// <param name="id">用户ID(必填)</param> /// <param name="email">用户邮箱(选填)</param> /// <param name="username">用户名(选填)</param> /// <param name="nickname">用户昵称(选填)</param> /// <param name="company">公司(选填)</param> /// <param name="photo">头像(选填)</param> /// <returns></returns> public string UpdateUserInfo(string id, string email, string username, string nickname, string company, string photo) { if (id == null || id == "") { throw new AuthingException("user id can not be empty!"); } Option option = new Option(inner.clientId); option.AddOption("_id", id); if (email != null && email != "") { option.AddOption("email", email); } if (username != null && username != "") { option.AddOption("username", username); } if (nickname != null && nickname != "") { option.AddOption("nickname", nickname); } if (company != null && company != "") { option.AddOption("company", company); } if (photo != null && photo != "") { option.AddOption("photo", photo); } return(inner.UpdateUser(option)); }
/// <summary> /// 修改密码 /// </summary> /// <param name="option"></param> /// <returns></returns> public string ChangePassword(string email, string verifyCode, string password) { if (email == "" || email == null) { throw new AuthingException("email can not be empty!"); } if (verifyCode == "" || verifyCode == null) { throw new AuthingException("verify code can not be empty!"); } if (password == null || password == "") { throw new AuthingException("password can not be empty!"); } Option option = new Option(); option.AddOption("client", inner.clientId); option.AddOption("email", email); option.AddOption("verifyCode", verifyCode); option.AddOption("password", password); return(inner.ChangePassword(option)); }