C
C#2w ago
Myrcin

Class separation

I've got a console app that does a lot of heavy lifting. Let's say it's got a service class (that performs http calls) as a dependency and the main class is calling it a multitude of times. The unit testing for the main class of the console app is becoming huge. Is it a good approach to just create a class that aggregates all the calls to the service class?
4 Replies
Jimmacle
Jimmacle2w ago
without knowing what the calls do, no do you have an example of the code you're trying to refactor?
Myrcin
MyrcinOP2w ago
Task<string?> SetProperty(string userID, string property, string value); This method gets called 9 times with different values It's for the same user but different properties
Jimmacle
Jimmacle2w ago
making another service to abstract that would make sense, as long as the operations are all related (like a UserService)
Myrcin
MyrcinOP2w ago
Thanks 🙏
Want results from more Discord servers?
Add your server