C
C#4d 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
Jimmacle4d ago
without knowing what the calls do, no do you have an example of the code you're trying to refactor?
Myrcin
MyrcinOP4d 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
Jimmacle4d ago
making another service to abstract that would make sense, as long as the operations are all related (like a UserService)
Myrcin
MyrcinOP4d ago
Thanks 🙏
Want results from more Discord servers?
Add your server