示例#1
0
        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));
        }
示例#2
0
        /// <summary>
        ///   Update an existing subaccount
        ///   <see cref="https://mandrillapp.com/api/docs/subaccounts.JSON.html#method=update">Mandrill API Documentation</see>
        /// </summary>
        /// <param name="request">The request</param>
        /// <returns>the information for the updated subaccount</returns>
        public async Task <SubaccountInfo> UpdateSubaccount(UpdateSubAccountRequest request)
        {
            const string path = "subaccounts/update.json";

            SubaccountInfo response = await Post <SubaccountInfo>(path, request).ConfigureAwait(false);

            return(response);
        }
示例#3
0
    /// <summary>
    ///   Update an existing subaccount
    ///   <see cref="https://mandrillapp.com/api/docs/subaccounts.JSON.html#method=update">Mandrill API Documentation</see>
    /// </summary>
    /// <param name="request">The request</param>
    /// <returns>the information for the updated subaccount</returns>
    public async Task<SubaccountInfo> UpdateSubaccount(UpdateSubAccountRequest request)
    {
      const string path = "subaccounts/update.json";

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

      return response;
    }