FormatRules() public method

public FormatRules ( RuleSet rules ) : string
rules xVal.RuleProviders.RuleSet
return string
        public void Single_Rule()
        {
            // Arrange
            var formatter = new JsonValidationConfigFormatter();
            var rules = RuleSetHelpers.MakeTestRuleSet(new Dictionary<string, IDictionary<string, object>> {
                {
                    "myprop", new Dictionary<string, object> {
                        { "somerule", new { param1 = "param1value", param2 = "param2value" } }
                    }
                }
            });
            rules["myprop"].First().ErrorMessage = "My_error_message";

            // Act
            var result = formatter.FormatRules(rules);

            // Assert
            Assert.Equal(@"{
            ""Fields"": [
            {""FieldName"" :""myprop"",
             ""FieldRules"":[
            {""RuleName"":""somerule"",
             ""RuleParameters"":{
                ""param1"":""param1value"",
                ""param2"":""param2value""
                },
             ""Message"":""My_error_message""
            }
            ]}
            ]
            }".Replace(" ", "").Replace(Environment.NewLine, ""), result);
        }
 private static string ClientSideValidationRules(RuleSet rules)
 {
     if (rules == null)
     {
         throw new ArgumentNullException("rules");
     }
     var formatter = new JsonValidationConfigFormatter();
     return formatter.FormatRules(rules);
 }
        public void EmptyRulesetFormatting()
        {
            // Arrange
            var formatter = new JsonValidationConfigFormatter();
            var rules = RuleSet.Empty;

            // Act
            var result = formatter.FormatRules(rules);

            // Assert
            Assert.Equal(@"{""Fields"":[]}", result);
        }