Пример #1
0
 public void MatchCaseInsensitive_StringNotMatched()
 {
     var value = new ValueCursor("xabcdef");
     Assert.True(value.MoveNext(), "GetNext() 1");
     Assert.False(value.MatchCaseInsensitive("abc", CultureInfo.InvariantCulture.CompareInfo, true));
     ValidateCurrentCharacter(value, 0, 'x');
 }
Пример #2
0
 public void MatchCaseInsensitive_MatchAndMove()
 {
     var value = new ValueCursor("abcd");
     Assert.True(value.MoveNext(), "GetNext() 1");
     Assert.True(value.MatchCaseInsensitive("AbC", CultureInfo.InvariantCulture.CompareInfo, true));
     ValidateCurrentCharacter(value, 3, 'd');
 }
Пример #3
0
 public void TestMatchCaseInsensitive_string()
 {
     var value = new ValueCursor("abc");
     Assert.True(value.MoveNext(), "GetNext() 1");
     Assert.True(value.MatchCaseInsensitive("AbC", CultureInfo.InvariantCulture.CompareInfo));
     Assert.False(value.MoveNext(), "GetNext() end");
 }
Пример #4
0
 public void MatchCaseInsensitive_MatchWithoutMoving()
 {
     var value = new ValueCursor("abcd");
     Assert.True(value.MoveNext(), "GetNext() 1");
     Assert.True(value.MatchCaseInsensitive("AbC", CultureInfo.InvariantCulture.CompareInfo, false));
     // We're still looking at the start
     ValidateCurrentCharacter(value, 0, 'a');
 }
Пример #5
0
            internal ParseResult <TResult> ParseEra <TResult>(NodaFormatInfo formatInfo, ValueCursor cursor)
            {
                var compareInfo = formatInfo.CompareInfo;

                foreach (var era in Calendar.Eras)
                {
                    foreach (string eraName in formatInfo.GetEraNames(era))
                    {
                        if (cursor.MatchCaseInsensitive(eraName, compareInfo, true))
                        {
                            Era = era;
                            return(null);
                        }
                    }
                }
                return(ParseResult <TResult> .MismatchedText(cursor, 'g'));
            }
            internal ParseResult <TResult> ParseEra <TResult>(NodaFormatInfo formatInfo, ValueCursor cursor)
            {
                var compareInfo = formatInfo.CompareInfo;
                var eras        = Calendar.Eras;

                for (int i = 0; i < eras.Count; i++)
                {
                    foreach (string eraName in formatInfo.GetEraNames(eras[i]))
                    {
                        if (cursor.MatchCaseInsensitive(eraName, compareInfo, true))
                        {
                            EraIndex = i;
                            return(null);
                        }
                    }
                }
                return(ParseResult <TResult> .MismatchedText('g'));
            }
Пример #7
0
 public void MatchCaseInsensitive_StringOverLongStringToMatch()
 {
     var value = new ValueCursor("x");
     Assert.True(value.MoveNext());
     Assert.False(value.MatchCaseInsensitive("long string", CultureInfo.InvariantCulture.CompareInfo, true));
     ValidateCurrentCharacter(value, 0, 'x');
 }