How to use (and test) TimeProvider timers in .NET

Testing timers in C# is difficult, but .NET 8 (C# 12) adds an abstract TimeProvider class that makes it easier. Let’s take a closer look.

  Jan 11, 2024 (rev. Sep 16, 2025) ·  10 min

How to use TimeProvider and FakeTimeProvider (time abstraction in .NET)

Testing time in C# is difficult, but .NET 8 (C# 12) adds an abstract TimeProvider class that makes it easier. Let’s take a closer look.

  Jan 7, 2024 (rev. Sep 16, 2025) ·  12 min

What is the NUnit constraint model?

I recently discovered the constraint model in NUnit. It’s been there for years, hiding in plain sight! What is it? Is it worth using? Let’s check it out.

  Jun 26, 2023 (rev. Sep 16, 2025) ·  9 min

Mocking MessageBox (or any static class) in WinForms

Unit testing a WinForms app is an uphill battle in the best of times, before you add in classes like MessageBox. Let’s make the best of it.

  Jan 7, 2022 (rev. Sep 16, 2025) ·  4 min

Using MVP to test a WinForms app

If you find yourself supporting a WinForms application, you’re likely to notice the tests… or lack thereof. Just because we may not have been so focused on automated tests and continuous integration when WinForms was younger, that doesn’t mean we can’t introduce them now. Better late than never!

  Jun 9, 2021 (rev. Sep 16, 2025) ·  9 min

What is mocking a dependency?

When you’re writing tests, you generally don’t want to write to the database, email customers, and hit third-party API’s. That’s why we need to know how to mock dependencies!

  Dec 9, 2020 (rev. Sep 16, 2025) ·  8 min

Using an application config file with a .NET Standard app and NUnit 3

Porting .NET Framework code to .NET Standard has been a learning experience, with some challenges too. This time I had a .NET Standard library that expected an application config file, but loading one from an NUnit test suite proved to be more difficult than it sounded at first.

  Apr 15, 2019 (rev. Sep 16, 2025) ·  6 min

Keep your EUnit teardown logic as simple as possible!

Ever had an EUnit test fixture fail with meck reporting it was “already_started”? Well I did, and here’s why…

  Mar 14, 2019 (rev. Sep 16, 2025) ·  6 min

Unit Testing in Visual Studio for Mac

Are you a Mac user and .NET fan? Did you know there’s a native VS app now? Writing tests is important, so I decided to try out NUnit in @vs4mac.

  Jul 6, 2017 (rev. Sep 16, 2025) ·  3 min