public void ModelSchema_Entities_Test() { var modelSchema = new ModelSchema(); var ctGna = new ModelComplexType() { Name = "gna" }; var etGna = new ModelEntity() { Name = "gna", EntityTypeName = "gna" }; modelSchema.ComplexTypes.Add(ctGna.AsFrozen()); modelSchema.Entities.Add(etGna); Assert.True(ReferenceEquals(etGna.Owner, modelSchema)); { var lstGna = modelSchema.FindEntity("gna"); Assert.Equal(1, lstGna.Count); Assert.True(ReferenceEquals(lstGna.Single(), etGna)); } { modelSchema.Freeze(); ctGna.ThrowIfNotFrozen(); } { var lstGna = modelSchema.FindEntity("gna"); Assert.Equal(1, lstGna.Count); Assert.True(ReferenceEquals(lstGna.Single(), etGna)); } }
public ModelEntity CreateModelEntity( string entityName, ModelEntityKind modelEntityKind, ModelErrors errors) { var result = new ModelEntity { Name = entityName, ExternalName = entityName, Kind = modelEntityKind }; return(this._RulesModelEntity.HandleRules(result.ExternalName, result, this.GenerateRules)); }