public DynamicContentWorkflowTests()
        {
            simpleWorkflow = new Workflow(
                Status.Draft,
                new Dictionary <Status, WorkflowStep>
            {
                [Status.Draft] =
                    new WorkflowStep(
                        new Dictionary <Status, WorkflowTransition>
                {
                    [Status.Published] = new WorkflowTransition()
                },
                        StatusColors.Draft),
                [Status.Published] =
                    new WorkflowStep(
                        new Dictionary <Status, WorkflowTransition>
                {
                    [Status.Draft] = new WorkflowTransition()
                },
                        StatusColors.Published)
            },
                new List <Guid> {
                simpleSchemaId.Id
            });

            var workflows = Workflows.Empty.Set(workflow).Set(Guid.NewGuid(), simpleWorkflow);

            A.CallTo(() => appProvider.GetAppAsync(appId.Id))
            .Returns(appEntity);

            A.CallTo(() => appEntity.Workflows)
            .Returns(workflows);

            sut = new DynamicContentWorkflow(new JintScriptEngine(), appProvider);
        }
Esempio n. 2
0
        public DynamicContentWorkflowTests()
        {
            app = Mocks.App(appId);

            var simpleWorkflow = new Workflow(
                Status.Draft,
                new Dictionary <Status, WorkflowStep>
            {
                [Status.Draft] =
                    new WorkflowStep(
                        new Dictionary <Status, WorkflowTransition>
                {
                    [Status.Published] = WorkflowTransition.Always
                }.ToReadonlyDictionary(),
                        StatusColors.Draft),
                [Status.Published] =
                    new WorkflowStep(
                        new Dictionary <Status, WorkflowTransition>
                {
                    [Status.Draft] = WorkflowTransition.Always
                }.ToReadonlyDictionary(),
                        StatusColors.Published)
            }.ToReadonlyDictionary(),
                ReadonlyList.Create(simpleSchemaId.Id));

            var workflows = Workflows.Empty.Set(workflow).Set(DomainId.NewGuid(), simpleWorkflow);

            A.CallTo(() => appProvider.GetAppAsync(appId.Id, false, default))
            .Returns(app);

            A.CallTo(() => app.Workflows)
            .Returns(workflows);

            var scriptEngine = new JintScriptEngine(new MemoryCache(Options.Create(new MemoryCacheOptions())),
                                                    Options.Create(new JintScriptOptions
            {
                TimeoutScript    = TimeSpan.FromSeconds(2),
                TimeoutExecution = TimeSpan.FromSeconds(10)
            }));

            sut = new DynamicContentWorkflow(scriptEngine, appProvider);
        }
        public DynamicContentWorkflowTests()
        {
            app = Mocks.App(appId);

            var simpleWorkflow = new Workflow(
                Status.Draft,
                new Dictionary <Status, WorkflowStep>
            {
                [Status.Draft] =
                    new WorkflowStep(
                        new Dictionary <Status, WorkflowTransition>
                {
                    [Status.Published] = WorkflowTransition.Always
                },
                        StatusColors.Draft),
                [Status.Published] =
                    new WorkflowStep(
                        new Dictionary <Status, WorkflowTransition>
                {
                    [Status.Draft] = WorkflowTransition.Always
                },
                        StatusColors.Published)
            },
                new List <DomainId> {
                simpleSchemaId.Id
            });

            var workflows = Workflows.Empty.Set(workflow).Set(DomainId.NewGuid(), simpleWorkflow);

            A.CallTo(() => appProvider.GetAppAsync(appId.Id, false))
            .Returns(app);

            A.CallTo(() => app.Workflows)
            .Returns(workflows);

            var memoryCache = new MemoryCache(Options.Create(new MemoryCacheOptions()));

            sut = new DynamicContentWorkflow(new JintScriptEngine(memoryCache), appProvider);
        }