public async Task Should_Return_List_Of_Sub_Accounts() { // Setup string apiKey = ConfigurationManager.AppSettings["APIKey"]; var request = new AddSubAccountRequest(Guid.NewGuid().ToString()) { CustomQuota = 10, Name = "subaccount1", Notes = "notes" }; // Exercise var api = new MandrillApi(apiKey); SubaccountInfo addedSubaccount = await api.AddSubaccount(request); List <SubaccountInfo> result = await api.ListSubaccounts(new ListSubAccountsRequest()); // Verify Assert.IsNotNull(result); Assert.IsNotEmpty(result); Assert.IsNotNull(result.Find(s => s.Id == addedSubaccount.Id)); // Cleanup await api.DeleteSubaccount(new DeleteSubAccountRequest(addedSubaccount.Id)); }
public async Task Should_Update_And_Return() { // Setup string apiKey = ConfigurationManager.AppSettings["APIKey"]; var request = new AddSubAccountRequest(Guid.NewGuid().ToString()) { CustomQuota = 10, Name = "subaccount1", Notes = "notes" }; // Exercise var api = new MandrillApi(apiKey); SubaccountInfo result = await api.AddSubaccount(request); string newName = result.Name + "2"; var updatedAccount = new UpdateSubAccountRequest(request.Id) { Name = newName }; SubaccountInfo updated = await api.UpdateSubaccount(updatedAccount); // Verify Assert.IsNotNull(updated); Assert.AreEqual(updated.Id, request.Id); Assert.AreEqual(updated.Name, newName); // Cleanup await api.DeleteSubaccount(new DeleteSubAccountRequest(updatedAccount.Id)); }
public async Task Should_Resume_And_Return_Sub_Account() { // Setup string apiKey = ConfigurationManager.AppSettings["APIKey"]; var request = new AddSubAccountRequest(Guid.NewGuid().ToString()) { CustomQuota = 10, Name = "subaccount1", Notes = "notes" }; // Exercise var api = new MandrillApi(apiKey); SubaccountInfo result = await api.AddSubaccount(request); SubaccountInfo paused = await api.PauseSubaccount(new PauseSubAccountRequest(request.Id)); SubaccountInfo resumed = await api.ResumeSubaccount(new ResumeSubAccountRequest(request.Id)); // Verify Assert.IsNotNull(paused); Assert.AreEqual(paused.Id, request.Id); Assert.AreEqual(resumed.Status, "active"); // Cleanup await api.DeleteSubaccount(new DeleteSubAccountRequest(result.Id)); }
public async Task Should_Pause_And_Return_Sub_Account() { // Setup string apiKey = ConfigurationManager.AppSettings["APIKey"]; var request = new AddSubAccountRequest(Guid.NewGuid().ToString()) { CustomQuota = 10, Name = "subaccount1", Notes = "notes" }; // Exercise var api = new MandrillApi(apiKey); SubaccountInfo result = await api.AddSubaccount(request); SubaccountInfo paused = await api.PauseSubaccount(new PauseSubAccountRequest(request.Id)); // Verify Assert.IsNotNull(paused); Assert.AreEqual(paused.Id, request.Id); Assert.AreEqual(paused.Status, "paused"); // Cleanup await api.DeleteSubaccount(new DeleteSubAccountRequest(result.Id)); }
public async Task Should_Return_List_Of_Sub_Accounts() { // Setup string apiKey = ConfigurationManager.AppSettings["APIKey"]; var request = new AddSubAccountRequest(Guid.NewGuid().ToString()) { CustomQuota = 10, Name = "subaccount1", Notes = "notes" }; // Exercise var api = new MandrillApi(apiKey); SubaccountInfo addedSubaccount = await api.AddSubaccount(request); List<SubaccountInfo> result = await api.ListSubaccounts(new ListSubAccountsRequest()); // Verify Assert.IsNotNull(result); Assert.IsNotEmpty(result); Assert.IsNotNull(result.Find(s => s.Id == addedSubaccount.Id)); // Cleanup await api.DeleteSubaccount(new DeleteSubAccountRequest(addedSubaccount.Id)); }
public void Delete_Subaccount_Returns_Deleted_Subaccount() { // Setup var apiKey = ConfigurationManager.AppSettings["APIKey"]; var subaccount = new SubaccountInfo { Id = Guid.NewGuid().ToString(), CustomQuota = 10, Name = "subaccount1" }; // Exercise var api = new MandrillApi(apiKey); var result = api.AddSubaccount(subaccount); var deletedSubaccount = api.DeleteSubaccount(result.Id); // Verify Assert.IsNotNull(deletedSubaccount); Assert.AreEqual(deletedSubaccount.Id, subaccount.Id); }
public void Delete_Subaccount_Is_No_Longer_Listed() { // Setup var apiKey = ConfigurationManager.AppSettings["APIKey"]; var subaccount = new SubaccountInfo { Id = Guid.NewGuid().ToString(), CustomQuota = 10, Name = "subaccount1" }; // Exercise var api = new MandrillApi(apiKey); var result = api.AddSubaccount(subaccount); var deletedSubaccount = api.DeleteSubaccount(result.Id); var list = api.ListSubaccounts(); // Verify Assert.IsNull(list.Find(s => s.Id == deletedSubaccount.Id)); }
public async Task Subaccount_Info_Returns_Subaccount() { // Setup string apiKey = ConfigurationManager.AppSettings["APIKey"]; var subaccount = new AddSubAccountRequest(Guid.NewGuid().ToString()) {CustomQuota = 10, Name = "subaccount1"}; // Exercise var api = new MandrillApi(apiKey); SubaccountInfo result = await api.AddSubaccount(subaccount); SubaccountInfo infoSubaccount = await api.SubaccountInfo(new SubAccountInfoRequest(subaccount.Id)); // Verify Assert.IsNotNull(infoSubaccount); Assert.AreEqual(infoSubaccount.Id, subaccount.Id); // Cleanup await api.DeleteSubaccount(new DeleteSubAccountRequest(subaccount.Id)); }
public async Task Subaccount_Info_Returns_Subaccount() { // Setup string apiKey = ConfigurationManager.AppSettings["APIKey"]; var subaccount = new AddSubAccountRequest(Guid.NewGuid().ToString()) { CustomQuota = 10, Name = "subaccount1" }; // Exercise var api = new MandrillApi(apiKey); SubaccountInfo result = await api.AddSubaccount(subaccount); SubaccountInfo infoSubaccount = await api.SubaccountInfo(new SubAccountInfoRequest(subaccount.Id)); // Verify Assert.IsNotNull(infoSubaccount); Assert.AreEqual(infoSubaccount.Id, subaccount.Id); // Cleanup await api.DeleteSubaccount(new DeleteSubAccountRequest(subaccount.Id)); }
public async Task Should_Delete_SubAccount_And_Returns_It() { // Setup string apiKey = ConfigurationManager.AppSettings["APIKey"]; var request = new AddSubAccountRequest(Guid.NewGuid().ToString()) { CustomQuota = 10, Name = "subaccount1", Notes = "notes" }; // Exercise var api = new MandrillApi(apiKey); SubaccountInfo result = await api.AddSubaccount(request); SubaccountInfo deletedSubaccount = await api.DeleteSubaccount(new DeleteSubAccountRequest(result.Id)); // Verify Assert.IsNotNull(deletedSubaccount); Assert.AreEqual(deletedSubaccount.Id, result.Id); }