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(); }
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(); }