Example #1
0
        public void ShouldReturnTrueWhenUpdatingEditorInterface()
        {
            var baseEditorInterface = new EditorInterface {
                Controls = new List <EditorInterfaceControl>()
            };
            var newEditorInterface = CreateDefaultNewEditorInterface();
            var definition         = new ContentTypeDefinition(null, newEditorInterface);

            baseEditorInterface.Controls.AddRange(new List <EditorInterfaceControl> {
                new EditorInterfaceControl {
                    FieldId = "EditorField1", WidgetId = "OldWidgetId1"
                }, new EditorInterfaceControl {
                    FieldId = "EditorField2", WidgetId = "OldWidgetId2"
                }
            });

            Assert.True(definition.Update(baseEditorInterface));
            for (var i = 0; i < baseEditorInterface.Controls.Count; i++)
            {
                Assert.Equal(definition.InferredEditorInterface.Controls[i].FieldId,
                             baseEditorInterface.Controls[i].FieldId);
                Assert.Equal(definition.InferredEditorInterface.Controls[i].WidgetId,
                             baseEditorInterface.Controls[i].WidgetId);
            }
        }
Example #2
0
        public void ShouldReturnFalseWhenUpdatingWithTheSameProperties()
        {
            var contentType     = CreateDefaultContentType();
            var definition      = new ContentTypeDefinition(contentType, null);
            var sameContentType = CreateDefaultContentType();

            Assert.False(definition.Update(sameContentType));
        }
Example #3
0
        public void ShouldReturnTrueWhenUpdatingWithDifferentProperties(Action <ContentType> setDifferentProperty)
        {
            var originalContentType = CreateDefaultContentType();
            var contentTypeClone    = CloneContentType(originalContentType);
            var definition          = new ContentTypeDefinition(contentTypeClone, null);

            setDifferentProperty(originalContentType);
            Assert.True(definition.Update(originalContentType));
        }
Example #4
0
        public void ShouldReturnFalseWhenUpdatingSameOrIncorrectEditorInterfaces(List <EditorInterfaceControl> controls)
        {
            var baseEditorInterface = new EditorInterface();
            var newEditorInterface  = CreateDefaultNewEditorInterface();
            var definition          = new ContentTypeDefinition(null, newEditorInterface);

            baseEditorInterface.Controls = controls;

            Assert.False(definition.Update(baseEditorInterface));
        }
Example #5
0
        public void ShouldReturnTrueForUpdatedFields(Action <List <Field> > modifyFields)
        {
            var originalContentType = CreateDefaultContentType();
            var contentTypeClone    = CloneContentType(originalContentType);
            var definition          = new ContentTypeDefinition(contentTypeClone, null);

            modifyFields(originalContentType.Fields);

            Assert.True(definition.Update(originalContentType));
        }