public async Task Attribute_exclusion_from_resource_definition_is_applied_for_non_empty_query_string()
        {
            // Arrange
            var resource = new CallableResource
            {
                Label     = "X",
                RiskLevel = 3
            };

            await _testContext.RunOnDatabaseAsync(async db =>
            {
                await db.GetCollection <CallableResource>().InsertOneAsync(resource);
            });

            var route = $"/callableResources/{resource.StringId}?fields[callableResources]=label,riskLevel";

            // Act
            var(httpResponse, responseDocument) = await _testContext.ExecuteGetAsync <Document>(route);

            // Assert
            httpResponse.Should().HaveStatusCode(HttpStatusCode.OK);

            responseDocument.SingleData.Should().NotBeNull();
            responseDocument.SingleData.Id.Should().Be(resource.StringId);
            responseDocument.SingleData.Attributes.Should().HaveCount(1);
            responseDocument.SingleData.Attributes["label"].Should().Be(resource.Label);
            responseDocument.SingleData.Relationships.Should().BeNull();
        }
        public async Task Queryable_parameter_handler_from_resource_definition_is_not_applied_on_secondary_request()
        {
            // Arrange
            var resource = new CallableResource
            {
                RiskLevel = 3,
                Children  = new List <CallableResource>
                {
                    new CallableResource
                    {
                        RiskLevel = 3
                    },
                    new CallableResource
                    {
                        RiskLevel = 8
                    }
                }
            };

            await _testContext.RunOnDatabaseAsync(async db =>
            {
                await db.GetCollection <CallableResource>().InsertOneAsync(resource);
            });

            var route = $"/callableResources/{resource.StringId}/children?isHighRisk=true";

            // Act
            var(httpResponse, responseDocument) = await _testContext.ExecuteGetAsync <ErrorDocument>(route);

            // Assert
            httpResponse.Should().HaveStatusCode(HttpStatusCode.BadRequest);

            responseDocument.Errors.Should().HaveCount(1);
            responseDocument.Errors[0].StatusCode.Should().Be(HttpStatusCode.BadRequest);
            responseDocument.Errors[0].Title.Should().Be("Custom query string parameters cannot be used on nested resource endpoints.");
            responseDocument.Errors[0].Detail.Should().Be("Query string parameter 'isHighRisk' cannot be used on a nested resource endpoint.");
            responseDocument.Errors[0].Source.Parameter.Should().Be("isHighRisk");
        }