Exemplo n.º 1
0
        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));
            }
        }
Exemplo n.º 2
0
        public ModelComplexType CreateModelComplexType(
            string complexTypeName,
            string complexTypeExternalName,
            ModelErrors errors)
        {
            var result = new ModelComplexType {
                Name         = complexTypeName,
                ExternalName = complexTypeExternalName ?? complexTypeName
            };

            return(this._RulesModelComplexType.HandleRules(result.ExternalName, result, this.GenerateRules));
        }
Exemplo n.º 3
0
        public void ModelSchema_ModelComplexType_Test()
        {
            var modelSchema = new ModelSchema();
            var ctGna       = new ModelComplexType()
            {
                Name = "gna"
            };

            modelSchema.ComplexTypes.Add(ctGna);
            ctGna.Freeze();
            Assert.True(ReferenceEquals(ctGna.Owner, modelSchema));
            var lstGna = modelSchema.FindComplexType("gna");

            Assert.Equal(1, lstGna.Count);
            Assert.True(ReferenceEquals(lstGna.Single(), ctGna));
        }