public void describe_should_return_description_for_filter( int maxNodeCount, string[] properties, AllowedLogicalOperators logicalOperators, AllowedArithmeticOperators arithmeticOperators, AllowedFunctions functions, string expected) { // arrange var provider = new DefaultODataQueryOptionDescriptionProvider(); var context = new ODataQueryOptionDescriptionContext() { MaxNodeCount = maxNodeCount, AllowedArithmeticOperators = arithmeticOperators, AllowedLogicalOperators = logicalOperators, AllowedFunctions = functions }; for (var i = 0; i < properties.Length; i++) { context.AllowedFilterProperties.Add(properties[i]); } // act var description = provider.Describe(Filter, context); // assert description.Should().Be(expected); }
public void describe_should_return_description_for_count() { // arrange var provider = new DefaultODataQueryOptionDescriptionProvider(); // act var description = provider.Describe(Count, new ODataQueryOptionDescriptionContext()); // assert description.Should().Be("Indicates whether the total count of items within a collection are returned in the result."); }
public void describe_should_not_allow_unsupported_query_option() { // arrange var provider = new DefaultODataQueryOptionDescriptionProvider(); var message = $"The query option $skiptoken is not supported.{NewLine}Parameter name: queryOption"; // act Action describe = () => provider.Describe(SkipToken, new ODataQueryOptionDescriptionContext()); // assert describe.Should().Throw <ArgumentException>().And.Message.Should().Be(message); }
public void describe_should_not_allow_multiple_query_options() { // arrange var provider = new DefaultODataQueryOptionDescriptionProvider(); var message = $"Only a single, valid query option may be specified.{NewLine}Parameter name: queryOption"; // act Action describe = () => provider.Describe(Supported, new ODataQueryOptionDescriptionContext()); // assert describe.Should().Throw <ArgumentException>().And.Message.Should().Be(message); }
public void describe_should_return_description_for_top(int?maxTop, string expected) { // arrange var provider = new DefaultODataQueryOptionDescriptionProvider(); // act var description = provider.Describe(Top, new ODataQueryOptionDescriptionContext() { MaxTop = maxTop }); // assert description.Should().Be(expected); }
public void describe_should_return_description_for_select(string[] properties, string expected) { // arrange var provider = new DefaultODataQueryOptionDescriptionProvider(); var context = new ODataQueryOptionDescriptionContext(); for (var i = 0; i < properties.Length; i++) { context.AllowedSelectProperties.Add(properties[i]); } // act var description = provider.Describe(Select, context); // assert description.Should().Be(expected); }
public void describe_should_return_description_for_expand(int maxDepth, string[] properties, string expected) { // arrange var provider = new DefaultODataQueryOptionDescriptionProvider(); var context = new ODataQueryOptionDescriptionContext() { MaxExpansionDepth = maxDepth }; for (var i = 0; i < properties.Length; i++) { context.AllowedExpandProperties.Add(properties[i]); } // act var description = provider.Describe(Expand, context); // assert description.Should().Be(expected); }
public void describe_should_return_description_for_orderby(int maxNodeCount, string[] properties, string expected) { // arrange var provider = new DefaultODataQueryOptionDescriptionProvider(); var context = new ODataQueryOptionDescriptionContext() { MaxOrderByNodeCount = maxNodeCount }; for (var i = 0; i < properties.Length; i++) { context.AllowedOrderByProperties.Add(properties[i]); } // act var description = provider.Describe(OrderBy, context); // assert description.Should().Be(expected); }