public void Create_When_Service_Name_Not_Specified_Should_Return_HttpClient_Without_Base_Address() { A.CallTo(() => _serviceRegistry.GetAll()).Returns(new List <IServiceConfig> { _config1 }); var result = (HttpClient)_underTest.Create(null); result.BaseAddress.Should().BeNull(); }
public HttpClientFactoryTests() { _serviceRegistry = A.Fake <IServiceRegistry>(); _config1 = A.Fake <IServiceConfig>(); A.CallTo(() => _serviceRegistry.Get(ServiceName)).Returns(_config1); A.CallTo(() => _serviceRegistry.GetAll()).Returns(new List <IServiceConfig> { _config1, A.Fake <IServiceConfig>() }); A.CallTo(() => _config1.AllowRedirect).Returns(true); A.CallTo(() => _config1.Timeout).Returns(TimeSpan.FromSeconds(222)); A.CallTo(() => _config1.BaseAddress).Returns("http://google.com"); A.CallTo(() => A.Fake <IServiceConfig>().AllowRedirect).Returns(false); A.CallTo(() => A.Fake <IServiceConfig>().Timeout).Returns(TimeSpan.FromSeconds(333)); A.CallTo(() => A.Fake <IServiceConfig>().BaseAddress).Returns("http://yandex.ru"); _underTest = new HttpClientFactory( _serviceRegistry ); }