コード例 #1
0
        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));
        }
コード例 #2
0
    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));
    }
コード例 #3
0
        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));
        }
コード例 #4
0
        public void List_Subaccounts_Contains_Added_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 addedSubaccount = api.AddSubaccount(subaccount);

            var result = api.ListSubaccounts();

            // Verify
            Assert.IsNotNull(result);
            Assert.IsNotEmpty(result);
            Assert.IsNotNull(result.Find(s => s.Id == addedSubaccount.Id));
        }
コード例 #5
0
        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));
        }
コード例 #6
0
        public void List_Subaccounts_Contains_Added_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 addedSubaccount = api.AddSubaccount(subaccount);

            var result = api.ListSubaccounts();

            // Verify
            Assert.IsNotNull(result);
            Assert.IsNotEmpty(result);
            Assert.IsNotNull(result.Find(s => s.Id == addedSubaccount.Id));
        }