Beispiel #1
0
        public void TestStringCondition1()
        {
            var cond = new StringMatchCondition("abc");

            Assert.IsTrue(cond.Matches("abc"));
            Assert.IsFalse(cond.Matches("abc1"));
        }
Beispiel #2
0
        public void TestStringCondition2()
        {
            var cond = new StringMatchCondition("abc", MatchType.BeginsWith);

            Assert.IsTrue(cond.Matches("abc"));
            Assert.IsTrue(cond.Matches("abc1"));
            Assert.IsFalse(cond.Matches("1abc"));
        }
Beispiel #3
0
        public void TestStringCondition3()
        {
            var cond = new StringMatchCondition("abc", MatchType.Contains);

            Assert.IsTrue(cond.Matches("abc"));
            Assert.IsTrue(cond.Matches("abc1"));
            Assert.IsTrue(cond.Matches("1abc"));
            Assert.IsFalse(cond.Matches("abd"));
        }
Beispiel #4
0
        public void TestStringCondition4()
        {
            var cond = new StringMatchCondition(".*ab[cd].*", MatchType.RegexMatch);

            Assert.IsTrue(cond.Matches("abc"));
            Assert.IsTrue(cond.Matches("abc1"));
            Assert.IsTrue(cond.Matches("1abc"));
            Assert.IsTrue(cond.Matches("abd"));
            Assert.IsFalse(cond.Matches("abef"));
        }
Beispiel #5
0
        public void TestExactMatch()
        {
            var cond1 = new StringMatchCondition("1", MatchType.Contains);
            var cond2 = new StringMatchCondition("2", MatchType.Contains);
            var cond3 = new StringMatchCondition("3", MatchType.Contains);

            var multi = new MultiMatchCondition <string>(new[] { cond1, cond2, cond3 });

            Assert.IsTrue(multi.Matches("432"));
            Assert.IsTrue(multi.Matches("123"));
            Assert.AreEqual(cond2, multi.MatchesExact("432"));
            Assert.AreEqual(cond1, multi.MatchesExact("123"));
        }
        public void IsConditionMet_EvaluatesTo_ExpectedResult(string goal, string?param, bool expected)
        {
            // Arrange
            var condition = new StringMatchCondition(goal);

            // Act
            if (param != null)
            {
                condition.ManipulateState(param);
            }

            // Assert
            Assert.Equal(expected, condition.IsConditionMet);
        }