public ContentQueryServiceTests()
        {
            user = new ClaimsPrincipal(identity);

            app = Mocks.App(appId);

            requestContext = new Context(user, app);

            var schemaDef =
                new Schema(schemaId.Name)
                .ConfigureScripts(new SchemaScripts {
                Query = "<query-script>"
            });

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

            SetupEnricher();

            A.CallTo(() => queryParser.ParseQuery(requestContext, schema, A <Q> .Ignored))
            .Returns(new ClrQuery());

            sut = new ContentQueryService(
                appProvider,
                urlGenerator,
                contentEnricher,
                contentRepository,
                contentVersionLoader,
                scriptEngine,
                queryParser);
        }
Beispiel #2
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, A <bool> ._))
            .Returns(schema);

            A.CallTo(() => appProvider.GetSchemasAsync(appId.Id))
            .Returns(new List <ISchemaEntity> {
                schema
            });

            A.CallTo(() => queryParser.ParseAsync(A <Context> ._, A <Q> ._, A <ISchemaEntity?> ._))
            .ReturnsLazily(c => Task.FromResult(c.GetArgument <Q>(1) !));

            sut = new ContentQueryService(
                appProvider,
                contentEnricher,
                contentRepository,
                contentVersionLoader,
                queryParser);
        }
Beispiel #3
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);
        }