public async Task Should_List_Rejects() { // Setup string apiKey = ConfigurationManager.AppSettings["APIKey"]; string reject1 = ConfigurationManager.AppSettings["RejectAdd"] + Guid.NewGuid(); string reject2 = ConfigurationManager.AppSettings["RejectAdd"] + Guid.NewGuid(); // Exercise var api = new MandrillApi(apiKey); //Verify await api.AddReject(new AddRejectRequest(reject1)); await api.AddReject(new AddRejectRequest(reject2)); List <RejectInfo> response = await api.ListRejects(new ListRejectsRequest()); // Verify Assert.Contains(reject1, response.Select(r => r.Email).ToList()); Assert.Contains(reject2, response.Select(r => r.Email).ToList()); // Cleanup await api.DeleteReject(new DeleteRejectRequest(reject1)); await api.DeleteReject(new DeleteRejectRequest(reject2)); }
public void Add_Reject_Works() { // Setup var apiKey = ConfigurationManager.AppSettings["APIKey"]; string reject = ConfigurationManager.AppSettings["RejectAdd"]; // Exercise var api = new MandrillApi(apiKey); //Verify var actual = api.AddReject(reject); Assert.AreEqual(reject, actual.Email); }
public void Add_Reject_Throws_Exception_On_Invalid_ApiKey() { // Setup var apiKey = " "; string reject = "*****@*****.**"; // Exercise var api = new MandrillApi(apiKey); // Verify var ex = Assert.Throws<MandrillException>(() => api.AddReject(reject)); Assert.That(ex.Error.name, Is.EqualTo("Invalid_Key")); }
public void Add_Reject_Throws_Exception_On_Invalid_ApiKey() { // Setup var apiKey = " "; string reject = "*****@*****.**"; // Exercise var api = new MandrillApi(apiKey); // Verify var ex = Assert.Throws <MandrillException>(() => api.AddReject(reject)); Assert.That(ex.Error.name, Is.EqualTo("Invalid_Key")); }
public async Task Should_Delete_Reject() { // Setup string apiKey = ConfigurationManager.AppSettings["APIKey"]; string reject = ConfigurationManager.AppSettings["RejectDelete"]; // Exercise var api = new MandrillApi(apiKey); //Verify RejectAddResult addResponse = await api.AddReject(new AddRejectRequest(reject)); RejectDeleteResult deleteResponse = await api.DeleteReject(new DeleteRejectRequest(addResponse.Email)); Assert.That(deleteResponse.Deleted, Is.True); }
public async Task Should_List_Rejects() { // Setup string apiKey = ConfigurationManager.AppSettings["APIKey"]; string reject1 = ConfigurationManager.AppSettings["RejectAdd"] + Guid.NewGuid(); string reject2 = ConfigurationManager.AppSettings["RejectAdd"] + Guid.NewGuid(); // Exercise var api = new MandrillApi(apiKey); //Verify await api.AddReject(new AddRejectRequest(reject1)); await api.AddReject(new AddRejectRequest(reject2)); List<RejectInfo> response = await api.ListRejects(new ListRejectsRequest()); // Verify Assert.Contains(reject1, response.Select(r => r.Email).ToList()); Assert.Contains(reject2, response.Select(r => r.Email).ToList()); // Cleanup await api.DeleteReject(new DeleteRejectRequest(reject1)); await api.DeleteReject(new DeleteRejectRequest(reject2)); }
public async Task Should_Add_Reject() { // Setup string apiKey = ConfigurationManager.AppSettings["APIKey"]; string reject = ConfigurationManager.AppSettings["RejectAdd"]; // Exercise var api = new MandrillApi(apiKey); //Verify RejectAddResult actual = await api.AddReject(new AddRejectRequest(reject)); Assert.That(actual.Added, Is.True); Assert.That(actual.Email, Is.EqualTo(reject)); // cleanup await api.DeleteReject(new DeleteRejectRequest(reject)); }