示例#1
0
        public async Task Can_start_and_start_container()
        {
            var hostedService = new HelloWorldHostedService(_loggerFactory.CreateLogger <DockerHostedService>());

            await hostedService.StartAsync(CancellationToken.None);

            await hostedService.StopAsync(CancellationToken.None);
        }
示例#2
0
        public async Task Should_use_existing_container()
        {
            var hostedService1 = new HelloWorldHostedService(_loggerFactory.CreateLogger <DockerHostedService>());
            await hostedService1.StartAsync(CancellationToken.None);

            var hostedService2 = new HelloWorldHostedService(_loggerFactory.CreateLogger <DockerHostedService>());
            await hostedService2.StartAsync(CancellationToken.None);

            await hostedService1.StopAsync(CancellationToken.None);

            await hostedService2.StopAsync(CancellationToken.None);
        }