public IOsuApiClient CreateClient() { if (_httpApiFactory == null) { _httpApiFactory = CreateFactory(_apiKeyFilter); } return(_httpApiFactory.CreateHttpApi()); }
public void CreateHttpApiTest() { var factory = new HttpApiFactory <IMyApi>(null, null) { Lifetime = TimeSpan.FromMilliseconds(100) }; var api1 = factory.CreateHttpApi(); var api2 = factory.CreateHttpApi(); Assert.True(IsHttpApiConfigEquals(api1, api2)); Assert.False(api1 == api2); Thread.Sleep(TimeSpan.FromMilliseconds(150)); var api3 = factory.CreateHttpApi(); Assert.False(IsHttpApiConfigEquals(api1, api3)); }
public void CreateHttpApiTest() { var factory = new HttpApiFactory <IMyApi>() .SetLifetime(TimeSpan.FromMilliseconds(100d)); var api1 = factory.CreateHttpApi(); var api2 = factory.CreateHttpApi(); Assert.True(IsHttpApiConfigEquals(api1, api2)); Assert.False(api1 == api2); Thread.Sleep(TimeSpan.FromMilliseconds(150)); var api3 = factory.CreateHttpApi(); Assert.False(IsHttpApiConfigEquals(api1, api3)); api3.Dispose(); Assert.True(GetHttpApiConfig(api3).IsDisposed == false); }