Ejemplo n.º 1
0
        public void ConfigureTaskHubWorker_ServicesAdded()
        {
            IHost host = CreateHost(
                _ => { },
                b => b.WithOrchestrationService(new LocalOrchestrationService()));

            TaskHubWorker worker = host.Services.GetService <TaskHubWorker>();
            IEnumerable <IHostedService> hostedServices = host.Services.GetServices <IHostedService>();

            worker.Should().NotBeNull();
            hostedServices.Should().HaveCount(1);
            hostedServices.Single().Should().BeOfType(typeof(TaskHubBackgroundService));
        }
Ejemplo n.º 2
0
 public void BuildTaskHubWorker()
 {
     RunTest(
         null,
         b =>
     {
         b.OrchestrationService = Mock.Of <IOrchestrationService>();
         TaskHubWorker worker   = b.Build(CreateServiceProvider());
         worker.Should().NotBeNull();
         worker.orchestrationService.Should().Be(b.OrchestrationService);
     },
         null);
 }
Ejemplo n.º 3
0
 public void BuildTaskHubWorker_WithMiddleware()
 {
     RunTest(
         null,
         b =>
     {
         b.OrchestrationService = Mock.Of <IOrchestrationService>();
         b.UseActivityMiddleware(new TaskMiddlewareDescriptor(typeof(TestMiddleware)));
         b.UseOrchestrationMiddleware(new TaskMiddlewareDescriptor(typeof(TestMiddleware)));
         TaskHubWorker worker = b.Build(CreateServiceProvider());
         worker.Should().NotBeNull();
         worker.orchestrationService.Should().Be(b.OrchestrationService);
     },
         null);
 }
Ejemplo n.º 4
0
        public void ConfigureTaskHubWorker_ServicesAdded3()
        {
            IHost host = CreateHost(
                _ => { },
#pragma warning disable CS0618 // Type or member is obsolete
                b => b.OrchestrationService = new LocalOrchestrationService());

#pragma warning restore CS0618 // Type or member is obsolete

            TaskHubWorker worker = host.Services.GetService <TaskHubWorker>();
            IEnumerable <IHostedService> hostedServices = host.Services.GetServices <IHostedService>();

            worker.Should().NotBeNull();
            hostedServices.Should().HaveCount(1);
            hostedServices.Single().Should().BeOfType(typeof(TaskHubBackgroundService));
        }