public void ParseKeys_ThrowsODataException_InvalidCountOfSingleQuoteForNonStringLiteral(string segment, string expectedError)
 {
     ExceptionAssert.Throws <ODataException>(() => KeyValueParser.ParseKeys(segment), expectedError);
 }
 public void ParseKeys_ThrowsODataException_DuplicateKey()
 {
     ExceptionAssert.Throws <ODataException>(() => KeyValueParser.ParseKeys("id=1,id=2"),
                                             "Duplicate key 'id' found in segment 'id=1,id=2'.");
 }
 public void ParseKeys_ThrowsODataException_NoValueWasFound(string segment, string expectedError)
 {
     ExceptionAssert.Throws <ODataException>(() => KeyValueParser.ParseKeys(segment), expectedError);
 }
 public void ParseKeys_ThrowsODataException_SegmentHasNoKeyName(string segment, string expectedError)
 {
     ExceptionAssert.Throws <ODataException>(() => KeyValueParser.ParseKeys(segment), expectedError);
 }
 public void ParseKeys_ThrowsODataException_HasABadFormatForSingleQuote(string segment, string expectedError)
 {
     ExceptionAssert.Throws <ODataException>(() => KeyValueParser.ParseKeys(segment), expectedError);
 }
 public void ParseKeys_ThrowsODataException_UnterminatedStringLiteral()
 {
     ExceptionAssert.Throws <ODataException>(() => KeyValueParser.ParseKeys("id1='123"),
                                             "Unterminated string literal at 4 in segment 'id1='123'.");
 }
        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));
        }