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);
        }
Ejemplo n.º 2
0
        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();

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

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

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

            A.CallTo(() => content.Id).Returns(contentId);
            A.CallTo(() => content.Data).Returns(contentData);
            A.CallTo(() => content.Status).Returns(Status.Published);

            sut = new ContentQueryService(contentRepository, appProvider, scriptEngine, modelBuilder);
        }
Ejemplo n.º 4
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);
        }
Ejemplo n.º 5
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(() => content.Id).Returns(contentId);
            A.CallTo(() => content.Data).Returns(contentData);
            A.CallTo(() => content.DataDraft).Returns(contentData);
            A.CallTo(() => content.Status).Returns(Status.Published);

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

            sut = new ContentQueryService(contentRepository, contentVersionLoader, appProvider, scriptEngine, modelBuilder);
        }
Ejemplo n.º 6
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.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);
        }