public async Task GetAllLogosForPartnerNoLogosReturned() { this.Fixture.MockProviderService .Given("There are no logos for any advertiser related to the requestor") .UponReceiving("a GET logos request to retrieve all logos") .With(new ProviderServiceRequest { Method = HttpVerb.Get, Path = AdPostingLogoApiFixture.LogoApiBasePath, Headers = new Dictionary <string, object> { { "Authorization", "Bearer " + this._oAuth2TokenRequestorB.AccessToken }, { "Accept", $"{ResponseContentTypes.LogoListVersion1}, {ResponseContentTypes.LogoErrorVersion1}" }, { "User-Agent", AdPostingApiFixture.UserAgentHeaderValue } } }) .WillRespondWith(new ProviderServiceResponse { Status = 200, Headers = new Dictionary <string, object> { { "Content-Type", ResponseContentTypes.LogoListVersion1 }, { "X-Request-Id", RequestId } }, Body = new { _embedded = new { logos = new List <LogoSummaryResource>() }, _links = new { self = new { href = AdPostingLogoApiFixture.LogoApiBasePath } } } }); LogoSummaryListResource logosSummary; using (AdPostingApiClient client = this.Fixture.GetClient(this._oAuth2TokenRequestorB)) { logosSummary = await client.GetAllLogosAsync(); var expectedLogos = new LogoSummaryListResource { Logos = new List <LogoSummaryResource>(), Links = new Links(this.Fixture.AdPostingApiServiceBaseUri) { { "self", new Link { Href = AdPostingLogoApiFixture.LogoApiBasePath } } }, RequestId = RequestId }; logosSummary.ShouldBeEquivalentTo(expectedLogos); } }
public async Task GetAllLogosForAdvertiserMultipleLogosReturned() { string queryString = "advertiserId=" + AdvertiserId1; this.Fixture.MockProviderService .Given("There are multiple logos for multiple advertisers related to the requestor") .UponReceiving("a GET logos request to retrieve all logos for an advertiser") .With(new ProviderServiceRequest { Method = HttpVerb.Get, Path = AdPostingLogoApiFixture.LogoApiBasePath, Query = queryString, Headers = new Dictionary <string, object> { { "Authorization", "Bearer " + this._oAuth2TokenRequestorA.AccessToken }, { "Accept", $"{ResponseContentTypes.LogoListVersion1}, {ResponseContentTypes.LogoErrorVersion1}" }, { "User-Agent", AdPostingApiFixture.UserAgentHeaderValue } } }) .WillRespondWith(new ProviderServiceResponse { Status = 200, Headers = new Dictionary <string, object> { { "Content-Type", ResponseContentTypes.LogoListVersion1 }, { "X-Request-Id", RequestId } }, Body = new { _embedded = new { logos = new[] { this._logo1.Build(), this._logo2.Build(), this._logo3.Build() } }, _links = new { self = new { href = $"{AdPostingLogoApiFixture.LogoApiBasePath}?{queryString}" } } } }); LogoSummaryListResource logosSummary; using (AdPostingApiClient client = this.Fixture.GetClient(this._oAuth2TokenRequestorA)) { logosSummary = await client.GetAllLogosAsync(AdvertiserId1); } LogoSummaryListResource expectedLogos = new LogoSummaryListResource { Logos = new List <LogoSummaryResource> { this._expectedLogoResource1, this._expectedLogoResource2, this._expectedLogoResource3 }, Links = new Links(this.Fixture.AdPostingApiServiceBaseUri) { { "self", new Link { Href = $"{AdPostingLogoApiFixture.LogoApiBasePath}?{queryString}" } } }, RequestId = RequestId }; logosSummary.ShouldBeEquivalentTo(expectedLogos); }