Exemple #1
0
        public ContentQueryServiceTests()
        {
            var schemaDef =
                new Schema(schemaId.Name)
                .SetScripts(new SchemaScripts {
                Query = "<query-script>"
            });

            schema = Mocks.Schema(appId, schemaId, schemaDef);

            SetupEnricher();

            A.CallTo(() => appProvider.GetSchemaAsync(appId.Id, schemaId.Name))
            .Returns(schema);

            A.CallTo(() => queryParser.ParseQueryAsync(A <Context> ._, schema, A <Q> ._))
            .Returns(new ClrQuery());

            sut = new ContentQueryService(
                appProvider,
                contentEnricher,
                contentRepository,
                contentVersionLoader,
                queryParser);
        }
        public async Task Should_use_existing_query()
        {
            var clrQuery = new ClrQuery();

            var parsed = await sut.ParseQueryAsync(requestContext, schema, Q.Empty.WithQuery(clrQuery));

            Assert.Same(parsed, clrQuery);
        }