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_Add_SubAccount_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);

      // Verify
      Assert.IsNotNull(result);
      Assert.AreEqual(result.Id, request.Id);
      Assert.AreEqual(result.Name, request.Name);
      Assert.AreEqual(result.CustomQuota, request.CustomQuota);
      Assert.AreEqual(result.Status, "active");
    }
    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_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));
    }
    /// <summary>
    ///   Add a new subaccount.
    ///   <see cref="https://mandrillapp.com/api/docs/subaccounts.JSON.html#method=add">Mandrill API Documentation</see>
    /// </summary>
    /// <param name="request">The subaccount request</param>
    /// <returns>the information saved about the new subaccount</returns>
    public async Task<SubaccountInfo> AddSubaccount(AddSubAccountRequest request)
    {
      const string path = "subaccounts/add.json";

      SubaccountInfo resp = await Post<SubaccountInfo>(path, request);

      return resp;
    }
    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));
    }