xVal.Rules.StringLengthRule.ListParameters C# (CSharp) Method

ListParameters() public method

public ListParameters ( ) : string>.System.Collections.Generic.IDictionary
return string>.System.Collections.Generic.IDictionary
        public override System.Collections.Generic.IDictionary<string, string> ListParameters()
        {
            var result = base.ListParameters();
            if(MinLength.HasValue) result.Add("MinLength", MinLength.ToString());
            if(MaxLength.HasValue) result.Add("MaxLength", MaxLength.ToString());
            return result;
        }

Usage Example

コード例 #1
0
ファイル: RulesTests.cs プロジェクト: chakrit/xVal-mirror
 public void StringLengthRule_Takes_Min_And_Max_Lengths()
 {
     var rule = new StringLengthRule(1, 5);
     var parameters = rule.ListParameters();
     Assert.Equal(2, parameters.Count);
     Assert.Equal("1", parameters["MinLength"]);
     Assert.Equal("5", parameters["MaxLength"]);
 }