public CampaignSubscriberResult GetBounces(int campaignId) { var url = $"{this._baseUrl}/campaigns/listBounces/"; var request = new RetrieveCampaignRequest { ApiKey = this._apiKey, CampaignId = campaignId }; var xmlRequest = this._parser.Serialize(request); var httpResponse = this._httpClient.Request(url, xmlRequest); if (httpResponse.Status != HttpStatus.Successful) { return(new CampaignSubscriberResult { Status = Status.Error, Message = "Http error" }); } var subscriberResult = this._parser.Deserialize <CampaignSubscriberResult>(httpResponse.Result); return(subscriberResult); }
public void SerializeRetrieveCampaignsRequest() { IXmlParser xmlParser = new DefaultXmlParser(); var request = new RetrieveCampaignRequest { ApiKey = "44-121312131223", CampaignId = 4123 }; var requestXml = xmlParser.Serialize(request); var xml = File.ReadAllText("RetrieveCampaignsRequest.xml"); Assert.AreEqual(xml, requestXml); }