コード例 #1
0
        private static void Test_Matched_Internal(string str, string format, params NameValue[] expectedPairs)
        {
            var result = FormattedStringValueExtracter.Extract(str, format);

            result.IsMatch.ShouldBe(true);

            if (expectedPairs == null)
            {
                result.Matches.Count.ShouldBe(0);
                return;
            }

            result.Matches.Count.ShouldBe(expectedPairs.Length);

            for (int i = 0; i < expectedPairs.Length; i++)
            {
                var actualMatch  = result.Matches[i];
                var expectedPair = expectedPairs[i];

                actualMatch.Name.ShouldBe(expectedPair.Name);
                actualMatch.Value.ShouldBe(expectedPair.Value);
            }
        }
コード例 #2
0
        private void Test_Not_Matched_Internal(string str, string format)
        {
            var result = FormattedStringValueExtracter.Extract(str, format);

            result.IsMatch.ShouldBe(false);
        }