public void StringMatchesExactlyRuleIsValid() { string target = "matt"; string comparisonValue = "matt"; StringMatchesExactly rule = new StringMatchesExactly("StringMatchesExactly", "The string value is not valid - does not match comparison value.", target, comparisonValue); Result result = rule.Execute(); Assert.IsTrue(result.IsValid); Assert.IsNotNullOrEmpty(result.Message); Assert.IsNotNull(result.RulePolicy); Assert.AreEqual(result.RulePolicy.Severity, Severity.Exception); }
/// <summary> /// Creates the rule. /// </summary> /// <param name="target"> </param> /// <returns> </returns> public override RulePolicy CreateRule(object target) { Rule = new StringMatchesExactly(RuleName, FailMessage, (string)target, comparisonValue); return Rule; }