Open EvilKot opened 1 month ago
@innomaxx please take a look
Hi @EvilKot. Good idea!
One of suggestions is to define interface for every ApiExecutor class or simply mark methods as virtual.
I suggest the 1st approach: define an interface for each API Executor. It's not so time-consuming, I can deal with it soon.
@andrii-bodnar what's your opinion?
Sounds good to me!
Hello 👋
In current implementation making API calls is done through methods in ApiExecutor classes, such as SourceFilesApiExecutor, SourceStringsApiExecutor, etc.
Example:
Since ICrowdinApiClient defines executor properties as concrete classes and those classes have non-virtual methods, it's not possible to mock a data returned by a client for unit testing purposes.
Moreover, since send request methods of the client are marked as internal, it's also not possible to at least mock the returned JSON, similarly to how it's done in Crowdin client unit tests.
Desired use case example:
One of suggestions is to define interface for every ApiExecturor class or simply mark methods as virtual. Current workaround is to define a wrapper class and proxy calls to Crowdin Api client.
WDYT?