public void GivenACompaniesHouseCompanyProfileClient_WhenGettingACompanyProfile() { _officers = new OfficersBuilder().Build(); var resource = new OfficersResourceBuilder(_officers).Create(); var uri = new Uri("https://wibble.com/search/companies"); HttpMessageHandler handler = new StubHttpMessageHandler(uri, resource); var uriBuilder = new Mock<IOfficersUriBuilder>(); uriBuilder.Setup(x => x.Build(It.IsAny<string>(), It.IsAny<int>(), It.IsAny<int>())) .Returns(uri); _client = new CompaniesHouseOfficersClient(new HttpClient(handler), uriBuilder.Object); _result = _client.GetOfficersAsync("abc", 0, 25).Result; _result.Data.ShouldBeEquivalentTo(_officers); }
public void GivenACompaniesHouseCompanyProfileClient_WhenGettingACompanyProfile() { _officers = new OfficersBuilder().Build(); var resource = new OfficersResourceBuilder(_officers).Create(); var uri = new Uri("https://wibble.com/search/companies"); HttpMessageHandler handler = new StubHttpMessageHandler(uri, resource); var uriBuilder = new Mock <IOfficersUriBuilder>(); uriBuilder.Setup(x => x.Build(It.IsAny <string>(), It.IsAny <int>(), It.IsAny <int>())) .Returns(uri); _client = new CompaniesHouseOfficersClient(new HttpClient(handler), uriBuilder.Object); _result = _client.GetOfficersAsync("abc", 0, 25).Result; _result.Data.ShouldBeEquivalentTo(_officers); }