public void TestAddEntity() { using (Stream stream = Resources.GetXmlDocumentStream("suppressed")) { Assert.IsNotNull(stream); WXMLModel model = WXMLModel.LoadFromXml(new XmlTextReader(stream)); Assert.IsNotNull(model); Assert.AreEqual(2, model.GetActiveEntities().Count()); WXMLModel newModel = new WXMLModel(); EntityDefinition newEntity = new EntityDefinition("ee", "ee", string.Empty, string.Empty, newModel); SourceFragmentRefDefinition sf = new SourceFragmentRefDefinition(newModel.GetOrCreateSourceFragment("dbo", "ee")); newEntity.AddSourceFragment(sf); newEntity.AddProperty(new ScalarPropertyDefinition(newEntity, "ID", "ID", Field2DbRelations.None, string.Empty, newModel.GetOrCreateType(typeof(Int32)), new SourceFieldDefinition(sf, "id"), AccessLevel.Private, AccessLevel.Public)); model.Merge(Normalize(newModel)); Assert.AreEqual(3, model.GetActiveEntities().Count()); Assert.AreEqual(1, model.GetActiveEntities().Single(item => item.Identifier == "ee").GetActiveProperties().Count()); } }