BEST PRACTICES

Best Practice for Using Timers in .NET C#

How to have full control over the Timer and be able to reach 100% coverage with unit tests.

Ahmed Tarek
Published in
10 min readDec 6, 2021

--

Best Practice for Using Timers in DotNet (.NET) CSharp (C#). Applying Dependency Injection (DI), Inversion of Control (IoC), Test Driven Development (TDD), Unit Testing, Coverage 100% Software Development Engineering Architecture Code Coding Programming
Photo by Agê Barros on Unsplash, adjusted by Ahmed Tarek

When using System.Timers.Timer in your .NET C# application, you might face problems with abstracting it and being able to cover your modules with Unit Tests.

--

--

Software Engineer 👨‍💻 | .NET dotnet C# csharp c-sharp | Website: https://www.developmentsimplyput.com | LinkedIn: @atarekhasan