예제 #1
0
        public void MetadataBinderProcessQueryOptionsWithNullBindMethodShouldThrow()
        {
            BindInfo bindInfo = new BindInfo();

            Action metadataBinderAction = () => MetadataBinder.ProcessQueryOptions(bindInfo.BindingState, null);

            metadataBinderAction.ShouldThrow <ODataException>(
                ODataErrorStrings.MetadataBinder_QueryOptionsBindMethodCannotBeNull);
        }
예제 #2
0
        public void MetadataBinderProcessQueryOptionsWithBindMethodThatReturnsNullShouldReturnEmptyList()
        {
            List <CustomQueryOptionToken> queryOptions = new List <CustomQueryOptionToken>();

            queryOptions.Add(new CustomQueryOptionToken(null, string.Empty));

            BindInfo bindInfo = new BindInfo(queryOptions, BindMethodReturnsNull);

            List <QueryNode> result = MetadataBinder.ProcessQueryOptions(bindInfo.BindingState, bindInfo.BindMethod);

            Assert.Empty(result);
        }
예제 #3
0
        public void MetadataBinderProcessQueryOptionsWithBindMethodThatReturnsNodeShouldReturnList()
        {
            List <CustomQueryOptionToken> queryOptions = new List <CustomQueryOptionToken>();

            queryOptions.Add(new CustomQueryOptionToken(null, string.Empty));

            BindInfo bindInfo = new BindInfo(queryOptions, BindMethodReturnsNode);

            List <QueryNode> result = MetadataBinder.ProcessQueryOptions(bindInfo.BindingState, bindInfo.BindMethod);

            result.Count.Should().Be(1);
        }
예제 #4
0
        public void MetadataBinderProcessQueryOptionsWithNullBindStateShouldThrow()
        {
            BindInfo bindInfo = new BindInfo();

            // Test null bind state
            Action metadataBinderAction = () => MetadataBinder.ProcessQueryOptions(null, bindInfo.BindMethod);

            metadataBinderAction.Throws <ODataException>(ODataErrorStrings.MetadataBinder_QueryOptionsBindStateCannotBeNull);

            // Test bind state that doesn't have query options populated
            metadataBinderAction = () => MetadataBinder.ProcessQueryOptions(bindInfo.BindingState, bindInfo.BindMethod);
            metadataBinderAction.Throws <ODataException>(
                ODataErrorStrings.MetadataBinder_QueryOptionsBindStateCannotBeNull);
        }