コード例 #1
0
        public async Task Should_Get_Template_Time_Series()
        {
            // Setup
            string       apiKey       = ConfigurationManager.AppSettings["APIKey"];
            string       templateName = Guid.NewGuid().ToString();
            const string code         = "Foobar";

            // Exercise
            var api = new MandrillApi(apiKey);
            await api.AddTemplate(new AddTemplateRequest(templateName)
            {
                FromName = "*****@*****.**",
                Code     = code,
                Text     = code,
                Publish  = true
            });

            List <TemplateTimeSeries> result = await api.TemplateTimeSeries(new TemplateTimeSeriesRequest(templateName));

            // Verify
            Assert.IsNotNull(result);

            //Time series do not exist for brand new templates. No other asserts possible.

            // Cleanup
            await api.DeleteTemplate(new DeleteTemplateRequest(templateName));
        }
コード例 #2
0
    public async Task Should_Return_Correct_Count()
    {
      // Setup
      string apiKey = ConfigurationManager.AppSettings["APIKey"];
      string templateName = Guid.NewGuid().ToString();
      const string code = "Foobar";

      // Exercise
      var api = new MandrillApi(apiKey);
      await api.AddTemplate(new AddTemplateRequest(templateName)
      {
        FromName = "*****@*****.**",
        Code = code,
        Text = code,
        Publish = true
      });


      List<TemplateInfo> result = await api.ListTemplates(new ListTemplatesRequest());

      Assert.True(result.Any(r => r.Name == templateName));

      // Cleanup
      await api.DeleteTemplate(new DeleteTemplateRequest(templateName));
      
    }
コード例 #3
0
    public async Task Should_Get_Template_Info()
    {
      // Setup
      string apiKey = ConfigurationManager.AppSettings["APIKey"];
      string templateName = Guid.NewGuid().ToString();
      const string code = "Foobar";

      // Exercise
      var api = new MandrillApi(apiKey);
      await api.AddTemplate(new AddTemplateRequest(templateName)
      {
        FromName = "*****@*****.**",
        Code = code,
        Text = code,
        Publish = true
      });


      TemplateInfo result = await api.TemplateInfo(new TemplateInfoRequest(templateName));

      // Verify
      Assert.AreEqual(templateName, result.Name);
      Assert.AreEqual(code, result.Code);

      // Cleanup
      await api.DeleteTemplate(new DeleteTemplateRequest(templateName));
    }
コード例 #4
0
        public async Task Should_Return_Correct_Count()
        {
            // Setup
            string       apiKey       = ConfigurationManager.AppSettings["APIKey"];
            string       templateName = Guid.NewGuid().ToString();
            const string code         = "Foobar";

            // Exercise
            var api = new MandrillApi(apiKey);
            await api.AddTemplate(new AddTemplateRequest(templateName)
            {
                FromName = "*****@*****.**",
                Code     = code,
                Text     = code,
                Publish  = true
            });


            List <TemplateInfo> result = await api.ListTemplates(new ListTemplatesRequest());

            Assert.True(result.Any(r => r.Name == templateName));

            // Cleanup
            await api.DeleteTemplate(new DeleteTemplateRequest(templateName));
        }
コード例 #5
0
    public async Task Should_Get_Template_Time_Series()
    {
      // Setup
      string apiKey = ConfigurationManager.AppSettings["APIKey"];
      string templateName = Guid.NewGuid().ToString();
      const string code = "Foobar";

      // Exercise
      var api = new MandrillApi(apiKey);
      await api.AddTemplate(new AddTemplateRequest(templateName)
      {
        FromName = "*****@*****.**",
        Code = code,
        Text = code,
        Publish = true
      });

      List<TemplateTimeSeries> result = await api.TemplateTimeSeries(new TemplateTimeSeriesRequest(templateName));

      // Verify
      Assert.IsNotNull(result);

      //Time series do not exist for brand new templates. No other asserts possible.

      // Cleanup
      await api.DeleteTemplate(new DeleteTemplateRequest(templateName));
    }
コード例 #6
0
        public async Task Should_Get_Template_Info()
        {
            // Setup
            string       apiKey       = ConfigurationManager.AppSettings["APIKey"];
            string       templateName = Guid.NewGuid().ToString();
            const string code         = "Foobar";

            // Exercise
            var api = new MandrillApi(apiKey);
            await api.AddTemplate(new AddTemplateRequest(templateName)
            {
                FromName = "*****@*****.**",
                Code     = code,
                Text     = code,
                Publish  = true
            });


            TemplateInfo result = await api.TemplateInfo(new TemplateInfoRequest(templateName));

            // Verify
            Assert.AreEqual(templateName, result.Name);
            Assert.AreEqual(code, result.Code);

            // Cleanup
            await api.DeleteTemplate(new DeleteTemplateRequest(templateName));
        }
コード例 #7
0
        public void Can_Create_And_Delete_Template()
        {
            // Setup
            var          apiKey       = ConfigurationManager.AppSettings["APIKey"];
            var          templateName = ConfigurationManager.AppSettings["TemplateExample"] + "_temp";
            const string code         = "Foobar";

            // Exercise
            var api     = new MandrillApi(apiKey);
            var result  = api.AddTemplate(templateName, "*****@*****.**", "Test", "Template test", code, code, true);
            var result2 = api.DeleteTemplate(templateName);

            // Verify
            Assert.AreEqual(code, result.code);
            Assert.AreEqual(code, result2.code);
        }
コード例 #8
0
        public void Can_Create_And_Delete_Template()
        {
            // Setup
            var apiKey = ConfigurationManager.AppSettings["APIKey"];
            var templateName = ConfigurationManager.AppSettings["TemplateExample"] + "_temp";
            const string code = "Foobar";

            // Exercise
            var api = new MandrillApi(apiKey);
            var result = api.AddTemplate(templateName, "*****@*****.**", "Test", "Template test", code, code, true);
            var result2 = api.DeleteTemplate(templateName);

            // Verify
            Assert.AreEqual(code, result.code);
            Assert.AreEqual(code, result2.code);
        }
コード例 #9
0
    public async Task Should_Create_And_Delete_Template()
    {
      // Setup
      string apiKey = ConfigurationManager.AppSettings["APIKey"];
      string templateName = ConfigurationManager.AppSettings["TemplateExample"] + "_temp";
      const string code = "Foobar";

      // Exercise
      var api = new MandrillApi(apiKey);
      TemplateInfo result = await api.AddTemplate(new AddTemplateRequest(templateName)
      {
        FromName = "*****@*****.**",
        Code = code,
        Text = code,
        Publish = true
      });
      TemplateInfo result2 = await api.DeleteTemplate(new DeleteTemplateRequest(templateName));

      // Verify
      Assert.AreEqual(code, result.Code);
      Assert.AreEqual(code, result2.Code);
    }
コード例 #10
0
        public async Task Should_Create_And_Delete_Template()
        {
            // Setup
            string       apiKey       = ConfigurationManager.AppSettings["APIKey"];
            string       templateName = ConfigurationManager.AppSettings["TemplateExample"] + "_temp";
            const string code         = "Foobar";

            // Exercise
            var          api    = new MandrillApi(apiKey);
            TemplateInfo result = await api.AddTemplate(new AddTemplateRequest(templateName)
            {
                FromName = "*****@*****.**",
                Code     = code,
                Text     = code,
                Publish  = true
            });

            TemplateInfo result2 = await api.DeleteTemplate(new DeleteTemplateRequest(templateName));

            // Verify
            Assert.AreEqual(code, result.Code);
            Assert.AreEqual(code, result2.Code);
        }