/// <summary> /// Set phone number. /// </summary> /// <remarks> /// Phone must be valid. /// When called multiple times, it will update existing phone number. /// </remarks> /// <returns> /// Itself. /// </returns> /// <param name='phone'> /// Phone. /// </param> /// <exception cref='ArgumentException'> /// Is thrown when an argument is invalid phone number. /// </exception> /// <exception cref='ArgumentNullException'> /// Is thrown when an argument is null or empty. /// </exception> public Builder WithPhone(string phone) { if (Utils.IsEmpty(phone)) { throw new ArgumentNullException("phone must not be empty."); } if (!KiiUser.IsValidPhone(phone)) { throw new ArgumentException(ErrorInfo.KIIUSER_PHONE_FORMAT_INVALID + phone); } this.phone = phone; return(this); }
public void Test_0206_isValidPhone_character() { Assert.IsFalse(KiiUser.IsValidPhone("+81A9011112222")); }
public void Test_0205_isValidPhone_hyphen() { Assert.IsTrue(KiiUser.IsValidPhone("+81-90-1111-2222")); }
public void Test_0204_isValidPhone_dot() { Assert.IsTrue(KiiUser.IsValidPhone("+81.9011112222")); }
public void Test_0203_isValidPhone_plus_only() { Assert.IsFalse(KiiUser.IsValidPhone("+")); }
public void Test_0202_isValidPhone_null() { Assert.IsFalse(KiiUser.IsValidPhone(null)); }
public void Test_0201_isValidPhone_plus() { Assert.IsTrue(KiiUser.IsValidPhone("+819011112222")); }
public void Test_0200_isValidPhone_OK() { Assert.IsTrue(KiiUser.IsValidPhone("09011112222")); }