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));
    }
Exemple #2
0
        public void Update_Subaccount_Returns_Updated_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 newName = result.Name + "2";

            result.Name = newName;

            var updated = api.UpdateSubaccount(result);

            // Verify
            Assert.IsNotNull(updated);
            Assert.AreEqual(updated.Id, subaccount.Id);
            Assert.AreEqual(updated.Name, newName);
        }
Exemple #3
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));
        }
        public void Update_Subaccount_Returns_Updated_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 newName = result.Name + "2";
            result.Name = newName;

            var updated = api.UpdateSubaccount(result);

            // Verify
            Assert.IsNotNull(updated);
            Assert.AreEqual(updated.Id, subaccount.Id);
            Assert.AreEqual(updated.Name, newName);
        }