From c820824a491f126adddcc58edade07ca83566e51 Mon Sep 17 00:00:00 2001 From: domayorov Date: Thu, 8 Aug 2024 16:13:06 +0200 Subject: [PATCH] refactor: remove unused timer provider --- src/SecTester.Core/Utils/ITimerProvider.cs | 11 ----------- src/SecTester.Core/Utils/SystemTimerProvider.cs | 14 -------------- .../Extensions/ServiceCollectionExtensions.cs | 1 - .../Bus/DefaultRepeaterBusFactoryTests.cs | 2 -- .../Extensions/ServiceCollectionExtensionsTests.cs | 10 ---------- 5 files changed, 38 deletions(-) delete mode 100644 src/SecTester.Core/Utils/ITimerProvider.cs delete mode 100644 src/SecTester.Core/Utils/SystemTimerProvider.cs diff --git a/src/SecTester.Core/Utils/ITimerProvider.cs b/src/SecTester.Core/Utils/ITimerProvider.cs deleted file mode 100644 index d4228e3..0000000 --- a/src/SecTester.Core/Utils/ITimerProvider.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System.Timers; - -namespace SecTester.Core.Utils; - -public interface ITimerProvider -{ - void Start(); - void Stop(); - double Interval { get; set; } - event ElapsedEventHandler Elapsed; -} diff --git a/src/SecTester.Core/Utils/SystemTimerProvider.cs b/src/SecTester.Core/Utils/SystemTimerProvider.cs deleted file mode 100644 index ad1d9ec..0000000 --- a/src/SecTester.Core/Utils/SystemTimerProvider.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System.Timers; - -namespace SecTester.Core.Utils; - -public class SystemTimerProvider : Timer, ITimerProvider -{ - public SystemTimerProvider() - { - } - - public SystemTimerProvider(double interval) : base(interval) - { - } -} diff --git a/src/SecTester.Repeater/Extensions/ServiceCollectionExtensions.cs b/src/SecTester.Repeater/Extensions/ServiceCollectionExtensions.cs index 92dd443..cff39b6 100644 --- a/src/SecTester.Repeater/Extensions/ServiceCollectionExtensions.cs +++ b/src/SecTester.Repeater/Extensions/ServiceCollectionExtensions.cs @@ -23,7 +23,6 @@ public static IServiceCollection AddSecTesterRepeater(this IServiceCollection co .AddSingleton() .AddScoped() .AddScoped() - .AddScoped() .AddScoped() .AddScoped(sp => protocol => sp.GetServices().FirstOrDefault(x => x.Protocol == protocol) diff --git a/test/SecTester.Repeater.Tests/Bus/DefaultRepeaterBusFactoryTests.cs b/test/SecTester.Repeater.Tests/Bus/DefaultRepeaterBusFactoryTests.cs index 83fa7d0..a7d8b29 100644 --- a/test/SecTester.Repeater.Tests/Bus/DefaultRepeaterBusFactoryTests.cs +++ b/test/SecTester.Repeater.Tests/Bus/DefaultRepeaterBusFactoryTests.cs @@ -7,11 +7,9 @@ public class DefaultRepeaterBusFactoryTests : IDisposable private const string Token = "0zmcwpe.nexr.0vlon8mp7lvxzjuvgjy88olrhadhiukk"; private readonly ILoggerFactory _loggerFactory = Substitute.For(); - private readonly ITimerProvider _timerProvider = Substitute.For(); public void Dispose() { - _timerProvider.ClearSubstitute(); _loggerFactory.ClearSubstitute(); GC.SuppressFinalize(this); } diff --git a/test/SecTester.Repeater.Tests/Extensions/ServiceCollectionExtensionsTests.cs b/test/SecTester.Repeater.Tests/Extensions/ServiceCollectionExtensionsTests.cs index 91e4b39..4991bd2 100644 --- a/test/SecTester.Repeater.Tests/Extensions/ServiceCollectionExtensionsTests.cs +++ b/test/SecTester.Repeater.Tests/Extensions/ServiceCollectionExtensionsTests.cs @@ -30,16 +30,6 @@ public void AddSecTesterRepeater_RegistersRepeaters() _sut.Received().AddScoped(); } - [Fact] - public void AddSecTesterRepeater_RegistersTimerProvider() - { - // act - _sut.AddSecTesterRepeater(); - - // assert - _sut.Received().AddScoped(); - } - [Fact] public void AddSecTesterRepeater_WithTimeout_RegistersHttpClient() {