Пример #1
0
        public void UpdateContentArea()
        {
            var updateContentArea = new ETContentArea
            {
                AuthStub    = client,
                CustomerKey = contentAreaName,
                Content     = updatedContent
            };
            var response = updateContentArea.Patch();

            Assert.AreEqual(response.Code, 200);

            var getContentArea = new ETContentArea
            {
                AuthStub     = client,
                Props        = new[] { "RowObjectID", "ObjectID", "ID", "CustomerKey", "Client.ID", "ModifiedDate", "CreatedDate", "CategoryID", "Name", "Layout", "IsDynamicContent", "Content", "IsSurvey", "IsBlank", "Key" },
                SearchFilter = new SimpleFilterPart {
                    Property = "CustomerKey", SimpleOperator = SimpleOperators.equals, Value = new[] { contentAreaName }
                },
            };
            var getResponse = getContentArea.Get();

            getContentArea = (ETContentArea)getResponse.Results[0];
            Assert.AreEqual(getResponse.Code, 200);
            Assert.AreEqual(getContentArea.Content, updatedContent);
        }
Пример #2
0
        public void DeleteContentArea()
        {
            var deleteContentArea = new ETContentArea
            {
                AuthStub    = client,
                CustomerKey = contentAreaName
            };
            var response = deleteContentArea.Delete();

            Assert.AreEqual(response.Code, 200);
            Assert.GreaterOrEqual(response.Results.Length, 1);
            Assert.AreEqual(response.Results[0].StatusMessage, "Content deleted");
            var getContentArea = new ETContentArea
            {
                AuthStub     = client,
                Props        = new[] { "RowObjectID", "ObjectID", "ID", "CustomerKey", "Client.ID", "ModifiedDate", "CreatedDate", "CategoryID", "Name", "Layout", "IsDynamicContent", "Content", "IsSurvey", "IsBlank", "Key" },
                SearchFilter = new SimpleFilterPart {
                    Property = "CustomerKey", SimpleOperator = SimpleOperators.equals, Value = new[] { contentAreaName }
                },
            };
            var getResponse = getContentArea.Get();

            Assert.AreEqual(getResponse.Code, 200);
            Assert.AreEqual(getResponse.Results.Length, 0);
        }