public void SchemaWriter_DeleteContentListType() { IntegrationTest(() => { var ed = new SchemaEditor(); ed.Load(); var contentListTypeCountBefore = ed.ContentListTypes.Count; var contentListTypeName1 = "LT1-" + Guid.NewGuid(); var contentListTypeName2 = "LT2-" + Guid.NewGuid(); var contentListTypeName3 = "LT3-" + Guid.NewGuid(); var contentListTypeName4 = "LT4-" + Guid.NewGuid(); ed.CreateContentListType(contentListTypeName1); ed.CreateContentListType(contentListTypeName2); ed.CreateContentListType(contentListTypeName3); ed.CreateContentListType(contentListTypeName4); ed.Register(); Assert.AreEqual(contentListTypeCountBefore + 4, StorageSchema.ContentListTypes.Count); // ACTION ed = new SchemaEditor(); ed.Load(); ed.DeleteContentListType(ed.ContentListTypes[contentListTypeName4]); // last ed.DeleteContentListType(ed.ContentListTypes[contentListTypeName2]); // middle ed.DeleteContentListType(ed.ContentListTypes[contentListTypeName1]); // first ed.Register(); // ASSERT Assert.AreEqual(contentListTypeCountBefore + 1, StorageSchema.ContentListTypes.Count); var listType = StorageSchema.ContentListTypes[contentListTypeName3]; Assert.AreEqual(contentListTypeName3, listType.Name); }); }
public void SchemaEditor_RemoveContentListType() { SchemaEditor editor = new SchemaEditor(); var lt1 = editor.CreateContentListType("LT1"); PropertyType slot1 = editor.CreateContentListPropertyType(DataType.String, 0); editor.AddPropertyTypeToPropertySet(slot1, lt1); editor.DeleteContentListType(editor.ContentListTypes["LT1"]); Assert.IsTrue(editor.ContentListTypes.Count == 0); }
public void SchEd_WriterCalling_DeleteContentListType() { Test(() => { SchemaEditor ed1 = new SchemaEditor(); SchemaEditor ed2 = new SchemaEditor(); SchemaEditorAccessor ed2Acc = new SchemaEditorAccessor(ed2); TestSchemaWriter wr = new TestSchemaWriter(); //-- create original ed1.CreateContentListPropertyType(DataType.String, 0); SetSchemaItemId(ed1.PropertyTypes["#String_0"], 1); ed1.CreateContentListType("LT1"); SetSchemaItemId(ed1.ContentListTypes["LT1"], 1); ed1.AddPropertyTypeToPropertySet(ed1.PropertyTypes["#String_0"], ed1.ContentListTypes["LT1"]); //-- create current ed2.CreateContentListPropertyType(DataType.String, 0); SetSchemaItemId(ed2.PropertyTypes["#String_0"], 1); ed2.CreateContentListType("LT1"); SetSchemaItemId(ed2.ContentListTypes["LT1"], 1); ed2.AddPropertyTypeToPropertySet(ed2.PropertyTypes["#String_0"], ed2.ContentListTypes["LT1"]); //-- edit ed2.DeleteContentListType(ed2.ContentListTypes["LT1"]); //-- register ed2Acc.RegisterSchema(ed1, wr); //-- test string expectedLog = @" Open(); DeleteContentListType(contentListType=<LT1>); Close(); " .Replace("\r\n", "").Replace("\t", "").Replace(" ", ""); string log = wr.Log.Replace("\r\n", "").Replace(" ", ""); Assert.IsTrue(log == expectedLog); }); }
public void SchEd_WriterCalling_DeleteContentListType() { SchemaEditor ed1 = new SchemaEditor(); SchemaEditor ed2 = new SchemaEditor(); SchemaEditorAccessor ed2Acc = new SchemaEditorAccessor(ed2); TestSchemaWriter wr = new TestSchemaWriter(); //-- create original ed1.CreateContentListPropertyType(DataType.String, 0); SetSchemaItemId(ed1.PropertyTypes["#String_0"], 1); ed1.CreateContentListType("LT1"); SetSchemaItemId(ed1.ContentListTypes["LT1"], 1); ed1.AddPropertyTypeToPropertySet(ed1.PropertyTypes["#String_0"], ed1.ContentListTypes["LT1"]); //-- create current ed2.CreateContentListPropertyType(DataType.String, 0); SetSchemaItemId(ed2.PropertyTypes["#String_0"], 1); ed2.CreateContentListType("LT1"); SetSchemaItemId(ed2.ContentListTypes["LT1"], 1); ed2.AddPropertyTypeToPropertySet(ed2.PropertyTypes["#String_0"], ed2.ContentListTypes["LT1"]); //-- edit ed2.DeleteContentListType(ed2.ContentListTypes["LT1"]); //-- register ed2Acc.RegisterSchema(ed1, wr); //-- test string expectedLog = @" Open(); DeleteContentListType(contentListType=<LT1>); Close(); ".Replace("\r\n", "").Replace("\t", "").Replace(" ", ""); string log = wr.Log.Replace("\r\n", "").Replace(" ", ""); Assert.IsTrue(log == expectedLog); }