public void allow_orderby_should_enable_query_option_with_property()
        {
            // arrange
            var builder = new TestODataActionQueryOptionsConventionBuilder();

            // act
            builder.AllowOrderBy("name");

            // assert
            builder.ValidationSettings.Should().BeEquivalentTo(
                new
            {
                AllowedQueryOptions      = OrderBy,
                AllowedOrderByProperties = new[] { "name" },
            },
                options => options.ExcludingMissingMembers());
        }
コード例 #2
0
        public void allow_orderby_should_enable_query_option_with_properties_and_max_expressions()
        {
            // arrange
            var builder = new TestODataActionQueryOptionsConventionBuilder();
            var properties = new[] { "name" }.AsEnumerable();

            // act
            builder.AllowOrderBy(42, properties);

            // assert
            builder.ValidationSettings.Should().BeEquivalentTo(
                new
            {
                AllowedQueryOptions      = OrderBy,
                MaxOrderByNodeCount      = 42,
                AllowedOrderByProperties = new[] { "name" },
            },
                options => options.ExcludingMissingMembers());
        }