public void hosted_service_is_started_and_stopped_in_idiomatic_mode()
        {
            var service = new MyHostedService();

            using (var runtime = JasperRuntime.For(x => x.Services.AddSingleton <IHostedService>(service)))
            {
                service.WasStarted.ShouldBeTrue();
                service.WasStopped.ShouldBeFalse();
            }

            service.WasStopped.ShouldBeTrue();
        }
Beispiel #2
0
        public async Task hosted_service_is_started_and_stopped_in_idiomatic_mode()
        {
            var service = new MyHostedService();

            var runtime = await JasperRuntime.ForAsync(x => x.Services.AddSingleton <IHostedService>(service));

            service.WasStarted.ShouldBeTrue();
            service.WasStopped.ShouldBeFalse();

            await runtime.Shutdown();

            service.WasStopped.ShouldBeTrue();
        }