Ejemplo n.º 1
0
        public async Task Engines_BasicEngine_ShouldRestorePartiallyCompletedState()
        {
            const int       jobsterCount   = 100;
            CoreTestContext context        = new CoreTestContext();
            TestJobster     initialJobster = new TestJobster(context)
            {
                Status = JobsterStatusEnum.Completed
            };

            IJobsterAsync <CoreTestContext>[] completedState =
            {
                initialJobster,
                new TestJobster(
                    context,
                    false,
                    new [] { initialJobster.JobId })
                {
                    Status = JobsterStatusEnum.NotStarted
                }
            };

            _ = await ExecuteOrchestrator(
                jobsterCount,
                jobsterCount,
                false,
                ExceptionPolicy.NoThrow,
                null,
                completedState);

            Assert.AreEqual(1, context.Counter);
        }
Ejemplo n.º 2
0
        public void Configuration_BasicConfiguration_ShouldNotAddDuplicatedJobsters()
        {
            TestJobster jobster  = new TestJobster(new CoreTestContext());
            TestJobster jobster2 = new TestJobster(new CoreTestContext());

            _jobsterBuilder.AddJobsters(jobster, jobster2, jobster);

            Assert.AreEqual(2, _jobsterBuilder.GetJobstersNumber());
        }
Ejemplo n.º 3
0
        public void Setup()
        {
            _rootJobster = new TestJobster(new TestJobsterContext());

            _d = new TestJobster(new TestJobsterContext(), new string[0]);
            _b = new TestJobster(new TestJobsterContext(), new[] { _rootJobster.JobId, _d.JobId });
            _c = new TestJobster(new TestJobsterContext(), new[] { _b.JobId });

            _jobsters = new List <IJobsterAsync <TestJobsterContext> >
            {
                _rootJobster, _d, _b, _c
            };
        }
Ejemplo n.º 4
0
        public void Engines_BasicEngine_ShouldValidateCyclicDependencies()
        {
            var rootJobster = new TestJobster(new CoreTestContext());
            var d           = new TestJobster(new CoreTestContext(), false, new string[0]);
            var b           = new TestJobster(new CoreTestContext(), false, new[] { rootJobster.JobId, d.JobId });
            var c           = new TestJobster(new CoreTestContext(), false, new[] { b.JobId });

            d.RequiredJobIds = new[] { rootJobster.JobId, c.JobId };

            List <IJobsterAsync <CoreTestContext> > jobsters = new List <IJobsterAsync <CoreTestContext> >
            {
                rootJobster, d, b, c
            };

            Assert.ThrowsAsync <CircularDependencyException>(async() => await new JobsterBuilder <CoreTestContext>(_mockLogger)
                                                             .AddJobsters(jobsters.ToArray())
                                                             .BuildEngine()
                                                             .ScheduleJobstersAsync(_cancellationTokenSource.Token));
        }