예제 #1
0
    public void CombineValidationTextNoneReturnsNone()
    {
        ValidationText vt = ValidationText.Create(new[] { ValidationText.None, ValidationText.None });

        Assert.Same(ValidationText.None, vt);
    }
예제 #2
0
 /// <summary>
 /// Text(验证)
 /// </summary>
 /// <param name="id">id/name</param>
 /// <param name="size">大小</param>
 /// <param name="validation">验证类型</param>
 /// <param name="tip">提示</param>
 /// <param name="description">描述</param>
 /// <returns></returns>
 public static IHtmlString TextKeyUp(string id, TextSize size, ValidationText validation, string tip = "", string description = "")
 {
     return
         new HtmlString(string.Format("<input type=\"text\" class=\"{1} {2}\" id=\"{0}\" name=\"{0}\"/>", id,
             size, validation.ToString())).AddTitle(tip, description);
 }
예제 #3
0
    public void CreateSingleStringEmptyReturnsEmpty()
    {
        ValidationText vt = ValidationText.Create((IEnumerable <string>) new[] { string.Empty });

        Assert.Same(ValidationText.Empty, vt);
    }
예제 #4
0
    public void CreateValidationTextEmptyReturnsEmpty()
    {
        ValidationText vt = ValidationText.Create(new[] { ValidationText.Empty });

        Assert.Same(ValidationText.Empty, vt);
    }
예제 #5
0
    public void CreateNoneItemStringEnumerableReturnsNone()
    {
        ValidationText vt = ValidationText.Create(ValidationText.None);

        Assert.Same(ValidationText.None, vt);
    }
예제 #6
0
    public void CreateStringEmptyReturnsEmpty()
    {
        ValidationText vt = ValidationText.Create(string.Empty);

        Assert.Same(ValidationText.Empty, vt);
    }
예제 #7
0
    public void CreateNullItemStringEnumerableReturnsNone()
    {
        ValidationText vt = ValidationText.Create((IEnumerable <string>) new string[] { null });

        Assert.Same(ValidationText.None, vt);
    }
예제 #8
0
    public void CreateNoneItemValidationTextEnumerableReturnsNone()
    {
        ValidationText vt = ValidationText.Create(new[] { ValidationText.None });

        Assert.Same(ValidationText.None, vt);
    }
예제 #9
0
 public SRPValidation(ValidationText validationText, ValidationEmail validationEmail, ValidationNumber validationNumber)
 {
     _validationText   = validationText;
     _validationEmail  = validationEmail;
     _validationNumber = validationNumber;
 }
예제 #10
0
    public void CreateNullValidationTextEnumerableReturnsNone()
    {
        ValidationText vt = ValidationText.Create((IEnumerable <ValidationText>)null);

        Assert.Same(ValidationText.None, vt);
    }
 /// <summary>
 /// Initializes a new instance of the <see cref="ValidationState"/> class.
 /// </summary>
 /// <param name="isValid">Determines if the property is valid or not.</param>
 /// <param name="text">Validation text.</param>
 /// <param name="component">Validation property.</param>
 public ValidationState(bool isValid, ValidationText text, IValidationComponent component)
 {
     IsValid   = isValid;
     Text      = text;
     Component = component;
 }
예제 #12
0
 /// <summary>
 /// Formats the <see cref="ValidationText"/> into a single line text using the
 /// default separator.
 /// </summary>
 /// <param name="validationText">ValidationText object to be formatted.</param>
 /// <returns>Returns the string formatted.</returns>
 public string Format(ValidationText validationText)
 {
     return(validationText != null
         ? validationText.ToSingleLine(_separator)
         : string.Empty);
 }
예제 #13
0
        private void UserName_KeyPress(object sender, KeyPressEventArgs e)
        {
            ValidationText log = new ValidationText();

            log.UserName_KeyPress(sender, e);
        }
 public string Format(ValidationText validationText) => _text;
 public CustomValidationState(bool isValid, string message)
 {
     IsValid = isValid;
     Text    = isValid ? ValidationText.Empty : ValidationText.Create(message);
 }