public void TestPostMailingUnsuccessful() { IAuthorizationStrategy basicAuthStrategy = MockAuthStrategy(); IServiceCommunicator serviceCommunicator = MockServiceCommunicator(); IStamprApiClient stamprApiClient = new StamprApiClient.StamprApiClient("http://no", _username, _password, serviceCommunicator, basicAuthStrategy); Assert.Throws <ServiceCommunicationException>(() => stamprApiClient.CreateMailing(1, "Add", "RetAdd", Format.none)); }
public void TestPostMailing() { IAuthorizationStrategy basicAuthStrategy = MockAuthStrategy(); IServiceCommunicator serviceCommunicator = MockServiceCommunicator(); IStamprApiClient stamprApiClient = new StamprApiClient.StamprApiClient(_url, _username, _password, serviceCommunicator, basicAuthStrategy); MailingModel postModel = new MailingModel() { Batch_Id = 4769, Format = Format.none, Address = "Add", ReturnAddress = "RetAdd" }; MailingModel model = stamprApiClient.CreateMailing(postModel); Assert.AreEqual(model.Batch_Id, postModel.Batch_Id); Assert.AreEqual(model.Format, postModel.Format); Assert.AreEqual(model.Address, postModel.Address); Assert.AreEqual(model.ReturnAddress, postModel.ReturnAddress); Assert.Greater(model.Mailing_Id, 0); Assert.Greater(model.User_Id, 0); }
public void TestPostMailingUnsuccessful() { IAuthorizationStrategy basicAuthStrategy = MockAuthStrategy(); IServiceCommunicator serviceCommunicator = MockServiceCommunicator(); IStamprApiClient stamprApiClient = new StamprApiClient.StamprApiClient("http://no", _username, _password, serviceCommunicator, basicAuthStrategy); Assert.Throws<ServiceCommunicationException>(() => stamprApiClient.CreateMailing(1, "Add", "RetAdd", Format.none)); }