public void ShouldReturnNullWhenNoContentFound() { const string registryUrl = "http://dummy"; const string content = ""; var httpClient = CreateHttpClientFactory(HttpStatusCode.NotFound, content); var service = new OrganizationService(registryUrl, httpClient); Task <Utilities.Organization.Organization> task = service.GetOrganizationByName("Kartverket"); Utilities.Organization.Organization organization = task.Result; organization.Should().BeNull(); }
public void ShouldReturnOrganizationWhenFoundByName() { const string registryUrl = "http://dummy"; const string content = @"{Number:""123456789"", Name:""Kartverket"", LogoUrl:""http://example.com/logo.png""}"; var httpClient = CreateHttpClientFactory(HttpStatusCode.OK, content); var service = new OrganizationService(registryUrl, httpClient); Task <Utilities.Organization.Organization> task = service.GetOrganizationByName("Kartverket"); Utilities.Organization.Organization organization = task.Result; organization.Should().NotBeNull(); organization.Number.Should().Be("123456789"); organization.Name.Should().Be("Kartverket"); organization.LogoUrl.Should().Be("http://example.com/logo.png"); }