コード例 #1
0
 /// <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);
 }
コード例 #2
0
 public void Test_0206_isValidPhone_character()
 {
     Assert.IsFalse(KiiUser.IsValidPhone("+81A9011112222"));
 }
コード例 #3
0
 public void Test_0205_isValidPhone_hyphen()
 {
     Assert.IsTrue(KiiUser.IsValidPhone("+81-90-1111-2222"));
 }
コード例 #4
0
 public void Test_0204_isValidPhone_dot()
 {
     Assert.IsTrue(KiiUser.IsValidPhone("+81.9011112222"));
 }
コード例 #5
0
 public void Test_0203_isValidPhone_plus_only()
 {
     Assert.IsFalse(KiiUser.IsValidPhone("+"));
 }
コード例 #6
0
 public void Test_0202_isValidPhone_null()
 {
     Assert.IsFalse(KiiUser.IsValidPhone(null));
 }
コード例 #7
0
 public void Test_0201_isValidPhone_plus()
 {
     Assert.IsTrue(KiiUser.IsValidPhone("+819011112222"));
 }
コード例 #8
0
 public void Test_0200_isValidPhone_OK()
 {
     Assert.IsTrue(KiiUser.IsValidPhone("09011112222"));
 }