public async void TestUpdateSubscriberAsync(UpdateSubscriberRequestModel requestModel) { var responseModel = await service.UpdateSubscriberAsync(requestModel); var encodedEmail = SerializationUtils.Base64Encode(requestModel.Email); Assert.Equal(HttpStatusCode.OK, responseModel.HttpResponse.StatusCode); Assert.NotNull(responseModel.Data); Assert.Equal(encodedEmail, responseModel.Data.ToParam); var expectedSelfLink = $"/api/account/{ACCOUNT_CODE}/subscribers/{encodedEmail}"; Assert.Equal(expectedSelfLink, responseModel.Data.SubscriberInfoLink.Href); }
public abstract Task <GovDeliveryResponseModel <UpdateSubscriberResponseModel> > UpdateSubscriberAsync(UpdateSubscriberRequestModel requestModel);
public override async Task <GovDeliveryResponseModel <UpdateSubscriberResponseModel> > UpdateSubscriberAsync(UpdateSubscriberRequestModel requestModel) { var encodedEmail = SerializationUtils.Base64Encode(requestModel.Email); var responseModel = new UpdateSubscriberResponseModel { ToParam = encodedEmail, SubscriberInfoLink = new LinkModel { Rel = "self", Href = $"/api/account/{accountCode}/subscribers/{encodedEmail}" } }; var httpResponse = new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = SerializationUtils.ModelToStringContent(responseModel) }; return(new GovDeliveryResponseModel <UpdateSubscriberResponseModel> { HttpResponse = httpResponse, Data = await SerializationUtils.ResponseContentToModel <UpdateSubscriberResponseModel>(httpResponse.Content) }); }
public override async Task <GovDeliveryResponseModel <UpdateSubscriberResponseModel> > UpdateSubscriberAsync(UpdateSubscriberRequestModel model) { var res = await client.PostAsync("subscriptions.xml", SerializationUtils.ModelToStringContent(model)); InterceptHttpError(res); return(new GovDeliveryResponseModel <UpdateSubscriberResponseModel> { HttpResponse = res, Data = null, }); }