当前位置: 首页>>代码示例>>C#>>正文


C# Parser.CallReset方法代码示例

本文整理汇总了C#中Parser.CallReset方法的典型用法代码示例。如果您正苦于以下问题:C# Parser.CallReset方法的具体用法?C# Parser.CallReset怎么用?C# Parser.CallReset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Parser的用法示例。


在下文中一共展示了Parser.CallReset方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Test_ReadValidCSharpName_Fails

        public void Test_ReadValidCSharpName_Fails()
        {
            var names = new[]
                {
                    "$Foo",
                    "+foo",
                    "-A",
                    "\"A\"",
                };

            foreach (var name in names)
            {
                var parser = new Parser();
                parser.CallReset(name);
                var exceptionThrown = false;
                try
                {
                    var result = parser.CallReadValidCSharpName();
                }
                catch (MvxException)
                {
                    exceptionThrown = true;
                }
                Assert.IsTrue(exceptionThrown);
            }
        }
开发者ID:darkice-matt-crombie,项目名称:MvxSpinnerTest,代码行数:26,代码来源:MvxParserTest.cs

示例2: DoReadEnumerationTest

 private void DoReadEnumerationTest(Type enumerationType, string input, object expectedOutput)
 {
     var parser = new Parser();
     parser.CallReset(input);
     var output = parser.CallReadEnumerationValue(enumerationType, true /* ignoreCase */);
     Assert.AreEqual(expectedOutput, output);
     Assert.IsTrue(parser.GetIsComplete());
 }
开发者ID:darkice-matt-crombie,项目名称:MvxSpinnerTest,代码行数:8,代码来源:MvxParserTest.cs

示例3: Test_ReadValidCSharpName_Succeeds

        public void Test_ReadValidCSharpName_Succeeds()
        {
            var names = new[]
                {
                    @"Foo",
                    @"foo",
                    @"A",
                    @"a",
                    @"_x",
                    @"x_x",
                    @"_2",
                    @"A5",
                    @"B_5_d",
                    @"B5_d_s_",
                };

            foreach (var name in names)
            {
                var parser = new Parser();
                parser.CallReset(name);
                var result = parser.CallReadValidCSharpName();
                Assert.AreEqual(name, result);
                Assert.IsTrue(parser.GetIsComplete());

                var parser2 = new Parser();
                parser2.CallReset("\t " + name + " \r \t");
                var result2 = parser2.CallReadValidCSharpName();
                Assert.AreEqual(name, result2);
                Assert.IsFalse(parser2.GetIsComplete());
            }
        }
开发者ID:darkice-matt-crombie,项目名称:MvxSpinnerTest,代码行数:31,代码来源:MvxParserTest.cs

示例4: DoReadValueTest

 private void DoReadValueTest(string input, object expectedOutput)
 {
     var parser = new Parser();
     parser.CallReset(input);
     var output = parser.CallReadValue();
     Assert.AreEqual(expectedOutput, output);
     Assert.IsTrue(parser.GetIsComplete());
 }
开发者ID:darkice-matt-crombie,项目名称:MvxSpinnerTest,代码行数:8,代码来源:MvxParserTest.cs

示例5: Test_CallReadUnsignedInteger_Reads_Numbers

        public void Test_CallReadUnsignedInteger_Reads_Numbers()
        {
            var testStrings = new Dictionary<string, uint>
                {
                    {"2", 2},
                    {"1234", 1234},
                    {UInt32.MaxValue.ToString(), UInt32.MaxValue},
                    {UInt32.MinValue.ToString(), UInt32.MinValue},
                };

            foreach (var testString in testStrings)
            {
                var tokeniser = new Parser();
                tokeniser.CallReset(testString.Key);
                var result = tokeniser.CallReadUnsignedInteger();
                Assert.AreEqual(testString.Value, result);
                Assert.IsTrue(tokeniser.GetIsComplete());
            }
        }
开发者ID:darkice-matt-crombie,项目名称:MvxSpinnerTest,代码行数:19,代码来源:MvxParserTest.cs

示例6: Test_CallReadQuotedString_Reads_Strings

        public void Test_CallReadQuotedString_Reads_Strings()
        {
            var testStrings = new Dictionary<string, string>
                {
                    {"''", ""},
                    {"\"Hello \\\"\\\'\"", "Hello \"\'"},
                    {"\"Hello\"", "Hello"},
                    {"'Hello'", "Hello"},
                    {"'Hello World'", "Hello World"},
                    {"'Hello \\r'", "Hello \r"},
                    {"'Hello \\u1234'", "Hello \u1234"},
                    {"'Hello \\U00001234'", "Hello \U00001234"},
                };

            foreach (var testString in testStrings)
            {
                var tokeniser = new Parser();
                tokeniser.CallReset(testString.Key);
                var result = tokeniser.CallReadQuotedString();
                Assert.AreEqual(testString.Value, result);
                Assert.IsTrue(tokeniser.GetIsComplete());
            }
        }
开发者ID:darkice-matt-crombie,项目名称:MvxSpinnerTest,代码行数:23,代码来源:MvxParserTest.cs

示例7: Test_Reset_Clears_And_Sets_All_Properties

 public void Test_Reset_Clears_And_Sets_All_Properties()
 {
     var tokeniser = new Parser();
     Assert.IsNull(tokeniser.GetFullText());
     Assert.AreEqual(0, tokeniser.GetCurrentIndex());
     var testString1 = @"1 test";
     tokeniser.CallReset(testString1);
     Assert.AreEqual(testString1, tokeniser.GetFullText());
     Assert.AreEqual(0, tokeniser.GetCurrentIndex());
     Assert.AreEqual(testString1[0], tokeniser.GetCurrentChar());
     var testString2 = @"2 test";
     tokeniser.CallReset(testString2);
     Assert.AreEqual(testString2, tokeniser.GetFullText());
     Assert.AreEqual(0, tokeniser.GetCurrentIndex());
     Assert.AreEqual(testString2[0], tokeniser.GetCurrentChar());
 }
开发者ID:darkice-matt-crombie,项目名称:MvxSpinnerTest,代码行数:16,代码来源:MvxParserTest.cs

示例8: Test_ReadTextUntilWhitespaceOr_ReadsText

 public void Test_ReadTextUntilWhitespaceOr_ReadsText()
 {
     var tests = new string[] { "fred;", "fred life;", "[email protected];", "fred", "fred\tlife;", "fred\n" };
     foreach (var test in tests)
     {
         var parser = new Parser();
         parser.CallReset(test);
         var output = parser.CallReadTextUntilWhitespaceOr('@', ';', ')');
         Assert.AreEqual("fred", output);
     }
 }
开发者ID:talisqualis,项目名称:MvvmCross-Build,代码行数:11,代码来源:MvxParserTest.cs


注:本文中的Parser.CallReset方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。