Exemplo n.º 1
0
        public void GetSavedSegmentsForList_Successful()
        {
            // Arrange
            MailChimpManager mc    = new MailChimpManager(TestGlobal.Test_APIKey);
            ListResult       lists = mc.GetLists();

            // Act
            SegmentResult result = mc.GetSegmentsForList(lists.Data[1].Id, "saved");

            // Assert
            Assert.IsTrue(result.SavedResult.Any());
        }
Exemplo n.º 2
0
    public static IEnumerable ListsSegments(SqlString apikey, SqlString list_id, SqlString segment_type)
    {
        List <SegmentRow> rows = new List <SegmentRow>();

        MailChimpManager mc = new MailChimpManager(apikey.ToString());

        SegmentResult result = mc.GetSegmentsForList(list_id.ToString(), segment_type.ToString());

        if (result.SavedResult != null)
        {
            foreach (SavedSegmentResult savedResult in result.SavedResult)
            {
                rows.Add(new SegmentRow
                {
                    Type        = segment_type.ToString(),
                    Id          = savedResult.Id,
                    Name        = savedResult.Name,
                    SegmentOpts = savedResult.SegmentOpts,
                    SegmentText = savedResult.SegmentText
                });
            }
        }

        if (result.StaticResult != null)
        {
            foreach (StaticSegmentResult staticResult in result.StaticResult)
            {
                rows.Add(new SegmentRow
                {
                    Type        = segment_type.ToString(),
                    Id          = staticResult.StaticSegmentId,
                    Name        = staticResult.SegmentName,
                    CreatedDate = staticResult.createdDate,
                    LastUpdate  = staticResult.lastUpdate,
                    LastReset   = staticResult.lastReset
                });
            }
        }

        return(rows);
    }
Exemplo n.º 3
0
 public void GetSavedSegmentsForList_Successful()
 {
     // Arrange 
     MailChimpManager mc = new MailChimpManager(TestGlobal.Test_APIKey);
     ListResult lists = mc.GetLists();
     
     // Act
     SegmentResult result = mc.GetSegmentsForList(lists.Data[1].Id, "saved");
     
     // Assert
     Assert.IsTrue(result.SavedResult.Any());
 }