MingweiSamuel / Camille

C# Riot API Library. Thread safe, automatic retries, autogenerated nightly releases.
Other
99 stars 8 forks source link

Unit testing #107

Closed w00lfer closed 5 months ago

w00lfer commented 5 months ago

Do you have any idea how could I mock RiotGamesApi class or HttpHandler inside of it for unit testing purposes? I wanted to unit test my service class which creates instance of RiotGamesApi like this and then uses it to retrieve summoners, matches etc data private RiotGamesApi GetConfiguredRiotGamesApi(string riotApiKey) { var config = new RiotGamesApiConfig.Builder(riotApiKey).Build(); return RiotGamesApi.NewInstance(config); }

My only idea is to create a "wrapper" around this class but tbh it's not best solution

MingweiSamuel commented 5 months ago

May be possible to use a mock server, now that #103/#108 is merged (will be in nightly release tonight)