コード例 #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();
        }
コード例 #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();
        }
コード例 #3
0
 public void Dispose()
 {
     ApiFactory?.Dispose();
     HttpClient?.Dispose();
 }