Ejemplo n.º 1
0
        public void ShouldNotDisposeHttpClient_WhenHttpClientIsProvidedByConsumer()
        {
            var fakeHttpClient = A.Fake <IHttpClient>();
            var api            = new ApiFactory().Create <IApi>(fakeHttpClient, false, new DefaultApiSettings());

            api.Dispose();
            A.CallTo(() => fakeHttpClient.Dispose()).MustNotHaveHappened();
        }
Ejemplo n.º 2
0
        public void ShouldDisposeHttpClient_WhenHttpClientIsCreatedInternally()
        {
            var fakeHttpClient = A.Fake <IHttpClient>();
            var api            = new ApiFactory().Create <IApi>(fakeHttpClient, true, new DefaultApiSettings());

            api.Dispose();
            A.CallTo(() => fakeHttpClient.Dispose()).MustHaveHappened();
        }
 public void Dispose()
 {
     ApiFactory?.Dispose();
     HttpClient?.Dispose();
 }