diff --git a/sample/Atc.Hosting.TimeFile.Sample/TimeFileScheduleWorker.cs b/sample/Atc.Hosting.TimeFile.Sample/TimeFileScheduleWorker.cs index f0f9ee6..f4c3223 100644 --- a/sample/Atc.Hosting.TimeFile.Sample/TimeFileScheduleWorker.cs +++ b/sample/Atc.Hosting.TimeFile.Sample/TimeFileScheduleWorker.cs @@ -23,12 +23,14 @@ public TimeFileScheduleWorker( public override Task StartAsync( CancellationToken cancellationToken) { + logger.LogInformation("Started"); return base.StartAsync(cancellationToken); } public override Task StopAsync( CancellationToken cancellationToken) { + logger.LogInformation("Stopped"); return base.StopAsync(cancellationToken); } diff --git a/sample/Atc.Hosting.TimeFile.Sample/TimeFileWorker.cs b/sample/Atc.Hosting.TimeFile.Sample/TimeFileWorker.cs index 64f5984..f7370b6 100644 --- a/sample/Atc.Hosting.TimeFile.Sample/TimeFileWorker.cs +++ b/sample/Atc.Hosting.TimeFile.Sample/TimeFileWorker.cs @@ -23,12 +23,14 @@ public TimeFileWorker( public override Task StartAsync( CancellationToken cancellationToken) { + logger.LogInformation("Started"); return base.StartAsync(cancellationToken); } public override Task StopAsync( CancellationToken cancellationToken) { + logger.LogInformation("Stopped"); return base.StopAsync(cancellationToken); } diff --git a/src/Atc.Hosting/Atc.Hosting.csproj b/src/Atc.Hosting/Atc.Hosting.csproj index 49ea401..c51f64d 100644 --- a/src/Atc.Hosting/Atc.Hosting.csproj +++ b/src/Atc.Hosting/Atc.Hosting.csproj @@ -14,10 +14,10 @@ - - + + - + \ No newline at end of file diff --git a/src/Atc.Hosting/Internal/NullBackgroundServiceHealthService.cs b/src/Atc.Hosting/Internal/NullBackgroundServiceHealthService.cs index 32dd2fb..5a54071 100644 --- a/src/Atc.Hosting/Internal/NullBackgroundServiceHealthService.cs +++ b/src/Atc.Hosting/Internal/NullBackgroundServiceHealthService.cs @@ -5,7 +5,7 @@ internal sealed class NullBackgroundServiceHealthService : IBackgroundServiceHea /// /// Returns static instance of /// - public static NullBackgroundServiceHealthService Instance => new NullBackgroundServiceHealthService(); + public static NullBackgroundServiceHealthService Instance => new(); private NullBackgroundServiceHealthService() { diff --git a/test/Atc.Hosting.Tests/XUnitTestTypes/MyWorkerService.cs b/test/Atc.Hosting.Tests/XUnitTestTypes/MyWorkerService.cs index 658e951..ce62214 100644 --- a/test/Atc.Hosting.Tests/XUnitTestTypes/MyWorkerService.cs +++ b/test/Atc.Hosting.Tests/XUnitTestTypes/MyWorkerService.cs @@ -31,14 +31,9 @@ public MyWorkerService( protected override Task OnExceptionAsync( Exception exception, CancellationToken stoppingToken) - { - if (exception is MyWorkerException) - { - throw exception; - } - - return Task.CompletedTask; - } + => exception is MyWorkerException + ? throw exception + : Task.CompletedTask; public override Task DoWorkAsync( CancellationToken stoppingToken)