move "async Task<RestResponse<T>> ExecuteAsync<T>" from Extension to IRestClient
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 45/100
Direzione di ricerca
Individua il metodo di estensione ExecuteAsync e l’interfaccia IRestClient con la relativa implementazione nel repository. Esamina le chiamate e i test esistenti relativi alle richieste tipizzate, quindi determina in che modo la modifica dell’interfaccia influisce sul mocking e sui consumer esistenti del metodo di estensione. L’attività è completata quando l’esecuzione tipizzata è disponibile tramite IRestClient e i test pertinenti coprono risposte mockate senza configurare un serializzatore.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
The extension-method
async Task<RestResponse<T>> ExecuteAsync<T>
Is the "natural" way to do a Request: everyting is TypeSave. But If you try to Mock IRestClient, you can only mock the Non-Typed Request-Reponse method.
In a Test-Scenario, we have to add the Serializers and use compute to Serialize & Deserialize, there is no full control on the response - the deserializers try to do the work - and an easy workaround with own serializer/deserialiser is not easy.
I had a long look at the sources, but using a custom Serializer did not worked out well. So I ended up with this Blog-Post unittest-with-restsharp
Yes, this works but is not intuitive.
Describe the solution you'd like
Having Task<RestResponse<T>> ExecuteAsync<T> in IRestClient would enable us to simple Mock the call. No additional Setup, No Serialization during the Test.
As far as I see, the ExtensionMethod can be moved to the RestClient-Implementation without breaking anything. All other ExtensionMethods will work, IRestClient-Implementation / Mocks will work.
You could move the method to the IRestClient Implementaion, extend the interface and remove the ExtensionMethod- without any side effects.
Describe alternatives you've considered
Considered? Mocking the Tests is complex. I considered to remove RestSharp - but my time is limited ;-) I did a complex initialization and hope my (future) colleagues will understand this in 2 years...
If I was unclear / any questions - may need some days for me to answer, but I'm here
- Lingua principale
- C#
- Stelle
- 9.8k
- Fork
- 2.3k
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di restsharp/RestSharp
-
RestClientOptions.UserAgent missing from requests with useClientFactory: trueForse già presa Una pull request collegata a questa issue è aperta o già unita. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
-
Expose HTTP response trailers on RestResponseForse già presa @Benziza l’ha presa 16 giorni fa. Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 68/100
-
RestClient configured with Newtonsoft.Json serializer still instantiates System.Text.JsonForse già presa @JiuYue0820 l’ha presa 57 giorni fa. Apertabug
Difficoltà 3/5 1-2 giorni Idoneità per principianti 65/100
-
bug
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
-
feature-request rfc
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
Tutte le issue di restsharp/RestSharp
Issue simili
-
needs-area
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
Azure/typespec-azure#5695 ·
I maintainer di solito rispondono entro 1 giorno
-
bug gui macos priority:low
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
OpenTabletDriver/OpenTabletDriver#5147 ·
I maintainer di solito rispondono entro 1 giorno
-
:watch: Not Triaged async-task-programming/subsvc dotnet-csharp/svc
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
I maintainer di solito rispondono entro 1 giorno
-
Python: Bug: AnnotationContent and StreamingAnnotationContent to_element writes CitationType.X, so annotations in a rendered chat history fail to parseForse già presa Una pull request collegata a questa issue è aperta o già unita. Apertapython triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
microsoft/semantic-kernel#14590 ·
I maintainer di solito rispondono entro 3 giorni
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
I maintainer di solito rispondono entro 1 giorno