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

            A.CallTo(() => app.Id).Returns(appId.Id);
            A.CallTo(() => app.Name).Returns(appId.Name);
            A.CallTo(() => app.LanguagesConfig).Returns(LanguagesConfig.English);

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

            A.CallTo(() => schema.Id).Returns(schemaId.Id);
            A.CallTo(() => schema.AppId).Returns(appId);
            A.CallTo(() => schema.SchemaDef).Returns(schemaDef);

            context = QueryContext.Create(app, user);

            var options = Options.Create(new ContentOptions {
                DefaultPageSize = 30
            });

            sut = new ContentQueryService(
                appProvider,
                urlGenerator,
                contentRepository,
                contentVersionLoader,
                scriptEngine,
                options,
                modelBuilder);
        }
Exemple #2
0
        public ContentQueryServiceTests()
        {
            user = new ClaimsPrincipal(identity);

            A.CallTo(() => app.Id).Returns(appId);
            A.CallTo(() => app.Name).Returns(appName);
            A.CallTo(() => app.LanguagesConfig).Returns(LanguagesConfig.English);

            A.CallTo(() => schema.SchemaDef).Returns(new Schema("my-schema"));

            context = new ContentQueryContext(QueryContext.Create(app, user));

            sut = new ContentQueryService(contentRepository, contentVersionLoader, appProvider, scriptEngine, modelBuilder);
        }
        public ContentQueryServiceTests()
        {
            user = new ClaimsPrincipal(identity);

            A.CallTo(() => app.Id).Returns(appId);
            A.CallTo(() => app.Name).Returns(appName);
            A.CallTo(() => app.LanguagesConfig).Returns(LanguagesConfig.English);

            A.CallTo(() => schema.AppId).Returns(new NamedId <Guid>(appId, appName));
            A.CallTo(() => schema.Id).Returns(schemaId);
            A.CallTo(() => schema.Name).Returns(schemaName);
            A.CallTo(() => schema.SchemaDef).Returns(new Schema(schemaName));
            A.CallTo(() => schema.ScriptQuery).Returns(script);

            context = new ContentQueryContext(QueryContext.Create(app, user));

            sut = new ContentQueryService(appProvider, contentRepository, contentVersionLoader, scriptEngine, Options.Create(new ContentOptions()), modelBuilder);
        }