public void MetadataBinderProcessQueryOptionsWithNullBindMethodShouldThrow() { BindInfo bindInfo = new BindInfo(); Action metadataBinderAction = () => MetadataBinder.ProcessQueryOptions(bindInfo.BindingState, null); metadataBinderAction.ShouldThrow <ODataException>( ODataErrorStrings.MetadataBinder_QueryOptionsBindMethodCannotBeNull); }
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); }
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); }
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); }