4 ms·
Isn't this just mostly an issue with mock testing in C#? Developers cargo cult single implementation interfaces because its so hard to mock concrete classes.
by vips7L 3y ago
Isn't this just mostly an issue with mock testing in C#? Developers cargo cult single implementation interfaces because its so hard to mock concrete classes.
- za3faran 3y agoI've seen the same in golang, which ironically is supposed to be vehemently against OOP.
- rjbwork 3y ago>Isn't this just mostly an issue with mock testing in C# Yes. You have two choices: Interface implemented once, or virtual on all your public members. I personally think Interface is the sane choice. Would be nice if the .NET devs let us mock POCO's though...
- hadrien01 3y agoYou can mock (well, "fake") POCOs with packages like AutoFixture that use reflection to generate mostly fake data, depending on what you need. You don't need interfaces or virtual, but you do need public getters unfortunately.