コード例 #1
0
        private static void ExtractSegmentIdentifierAndParenthesisExpression(string segment, string expectedIdentifier, string expectedQueryPortion)
        {
            string actualIdentifier;
            string queryPortion;

            ODataPathParser.ExtractSegmentIdentifierAndParenthesisExpression(segment, out actualIdentifier, out queryPortion);
            actualIdentifier.Should().Be(expectedIdentifier);
            queryPortion.Should().Be(expectedQueryPortion);
        }
コード例 #2
0
        public void RequestUriProcessorExtractSegmentIdentifierErrorTest()
        {
            string actualIdentifier;
            string queryPortion;

            Action emptyString = () => ODataPathParser.ExtractSegmentIdentifierAndParenthesisExpression(string.Empty, out actualIdentifier, out queryPortion);

            emptyString.ShouldThrow <ODataException>(ErrorStrings.RequestUriProcessor_EmptySegmentInRequestUrl);

            Action noIdentifier = () => ODataPathParser.ExtractSegmentIdentifierAndParenthesisExpression("()", out actualIdentifier, out queryPortion);

            noIdentifier.ShouldThrow <ODataException>(ErrorStrings.RequestUriProcessor_EmptySegmentInRequestUrl);

            Action noEndParen = () => ODataPathParser.ExtractSegmentIdentifierAndParenthesisExpression("foo(", out actualIdentifier, out queryPortion);

            noEndParen.ShouldThrow <ODataException>(ErrorStrings.RequestUriProcessor_SyntaxError);
        }