
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.
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.
There’s a lot of ways to make our code work for us. Let’s check out using the nameof operator to avoid magic strings.
If you’re in a legacy codebase with a centralized “message box” form, why not add some features that make it work for you? 😏
Logs are a great tool for squashing bugs and tracing errors. Let’s see how to add NLog to our project.
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!
Using the async/await pattern in WinForms is an easy win, helping prevent one of the most annoying user experiences - a frozen UI.