コード例 #1
0
ファイル: RuleTests.cs プロジェクト: kahneraja/Vergosity
        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);
        }
コード例 #2
0
 /// <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;
 }