コード例 #1
0
        public void CSharpCodeMatcher_For_String_SinglePattern_IsMatch_Positive()
        {
            // Assign
            string input = "x";

            // Act
            var matcher = new CSharpCodeMatcher("return it == \"x\";");

            // Assert
            Check.That(matcher.IsMatch(input)).IsEqualTo(1.0d);
        }
コード例 #2
0
        public void CSharpCodeMatcher_For_String_IsMatch_RejectOnMatch()
        {
            // Assign
            string input = "x";

            // Act
            var matcher = new CSharpCodeMatcher(MatchBehaviour.RejectOnMatch, "return it == \"x\";");

            // Assert
            Check.That(matcher.IsMatch(input)).IsEqualTo(0.0d);
        }
コード例 #3
0
        public void CSharpCodeMatcher_For_String_IsMatch_Negative()
        {
            // Assign
            string input = "y";

            // Act
            var matcher = new CSharpCodeMatcher("return it == \"x\";");

            // Assert
            Check.That(matcher.IsMatch(input)).IsEqualTo(0.0d);
        }
コード例 #4
0
        public void CSharpCodeMatcher_For_Object_IsMatch()
        {
            // Assign
            var input = new
            {
                Id   = 9,
                Name = "Test"
            };

            // Act
            var    matcher = new CSharpCodeMatcher("return it.Id > 1 && it.Name == \"Test\";");
            double match   = matcher.IsMatch(input);

            // Assert
            Assert.Equal(1.0, match);
        }