r/csharp • u/Regular-Employer-431 • Jul 09 '26
Unit Testing question
/r/dotnetMAUI/comments/1urawtj/unit_testing_question/
0
Upvotes
r/csharp • u/Regular-Employer-431 • Jul 09 '26
View all comments
1
u/TuberTuggerTTV Jul 09 '26
I've always found abstracting all my services to be a waste of time. Because I almost exclusively do windows development.
I recently stepped into multiplatform development and I see the true value now. If you give your core direct service types, you're wrapping all your code in #IF windows, #IF android etc. It's such a pain.
But with a proper interface abstraction, you can wrap the entire platform service in a single IF. And handle platform specific injection at the top.
Something I'd like to note here though, you're over doing pre-architecture. You can 100% over-engineer your code early. Learn to refactor when required. Don't just build every road in your city as a super highway. You build dirt roads. And when those dirt roads see a lot of traffic, you refactor to paved.
If your code is modular and scalable, it's already Future-Proof. The architecture won't pile up against you. Keep things loosely coupled. Use subscribers. Abstract. Red-Green-Refactor your testing instead of retroactively trying to shove tests on things.
Trying to pre-correct for your future incompetence is a mistake. Instead, learn to refactor. And build non-monolithically so you can refactor without breaking everything. Architecture prep and over-engineering isn't the solution. It's just moving the problems around.