Exemplo n.º 1
0
        private static Dictionary <string, string> GetParameters(string nextSegment)
        {
            Dictionary <string, string> parameters = null;

            if (IsEnclosedInParentheses(nextSegment))
            {
                string value = nextSegment.Substring(1, nextSegment.Length - 2);
                parameters = KeyValueParser.ParseKeys(value);
            }

            return(parameters);
        }
Exemplo n.º 2
0
 public void ParseKeys_ThrowsODataException_InvalidCountOfSingleQuoteForNonStringLiteral(string segment, string expectedError)
 {
     Assert.Throws <ODataException>(() => KeyValueParser.ParseKeys(segment), expectedError);
 }
Exemplo n.º 3
0
 public void ParseKeys_ThrowsODataException_DuplicateKey()
 {
     Assert.Throws <ODataException>(() => KeyValueParser.ParseKeys("id=1,id=2"),
                                    "Duplicate key 'id' found in segment 'id=1,id=2'.");
 }
Exemplo n.º 4
0
 public void ParseKeys_ThrowsODataException_NoValueWasFound(string segment, string expectedError)
 {
     Assert.Throws <ODataException>(() => KeyValueParser.ParseKeys(segment), expectedError);
 }
Exemplo n.º 5
0
 public void ParseKeys_ThrowsODataException_SegmentHasNoKeyName(string segment, string expectedError)
 {
     Assert.Throws <ODataException>(() => KeyValueParser.ParseKeys(segment), expectedError);
 }
Exemplo n.º 6
0
 public void ParseKeys_ThrowsODataException_HasABadFormatForSingleQuote(string segment, string expectedError)
 {
     Assert.Throws <ODataException>(() => KeyValueParser.ParseKeys(segment), expectedError);
 }
Exemplo n.º 7
0
 public void ParseKeys_ThrowsODataException_UnterminatedStringLiteral()
 {
     Assert.Throws <ODataException>(() => KeyValueParser.ParseKeys("id1='123"),
                                    "Unterminated string literal at 4 in segment 'id1='123'.");
 }
Exemplo n.º 8
0
        public void ParseKeys(string str, IEnumerable <string> expectedKeyValues)
        {
            var result = KeyValueParser.ParseKeys(str);

            Assert.Equal(result.Select(r => r.Key + ":" + r.Value).OrderBy(r => r), expectedKeyValues.OrderBy(k => k));
        }