Closed AnuBargreen closed 2 months ago
Would be nice if this change can be made in the next release, I'm having issues trying to write unit test using this client
+1 to this. It is very difficult to unit test interactions with the ISearchClient
. Also related to #745
Hello,
We will release in few days a new major version of all Algolia C# Clients. In this version, all clients returns interfaces to enhance testability.
I'll reply in this thread as soon as the client is released.
@rmendoza-prescriber @PritamSanganiTW @AnuBargreen
The Alpha version is now released on Nuget.
If you have time, we need customer feedback about this new version. It's still not GA so you may not want to use it in production.
There is no more deps on Newtonsoft, all Algolia APIs are now available (Insights, Recommend, Query Perso, ...) and all models and routes are synced.
To help you migrate, there is a Migration guide.
Happy to help in your migration process !
Hello, in version 7 all clients extends from an interface, closing this issue.
Description
ISearchClient
should depend on interfaces and not concrete types. This breaks Liskov substitution principle when testing this. The concrete typeSearchIndex
has ainternal
constructor making it harder to wrap this for testing.https://github.com/algolia/algoliasearch-client-csharp/blob/0c2faadf050c9c9801500d7bc603fdbc33aad696/src/Algolia.Search/Clients/ISearchClient.cs#L45-L50
Steps To Reproduce
Use
Moq
to create a Mock ofSearchClient
and setup responses to various calls: