Esempio n. 1
0
        public void Gender()
        {
            lock (testLock)
            {
                // Get the code namespace for the schema.
                string inputFilePath = GetInputFilePath("Gender.xsd", Resources.Gender);

                var generatorParams = GetGeneratorParams(inputFilePath);
                generatorParams.TargetFramework = TargetFramework.Net30;
                generatorParams.PropertyParams.AutomaticProperties = true;
                generatorParams.GenerateDataContracts = true;
                generatorParams.Serialization.GenerateXmlAttributes = true;
                generatorParams.OutputFilePath = GetOutputFilePath(inputFilePath);
                GenerateAndCompile(generatorParams);

                var genderRoot = new Root
                {
                    GenderAttribute          = ksgender.female,
                    GenderAttributeSpecified = true,
                    GenderElement            = ksgender.female,
                    GenderIntAttribute       = "toto"
                };
                Exception ex;
                genderRoot.SaveToFile(GetOutputFullFileName("gender.xml"), out ex);
                if (ex != null)
                {
                    throw ex;
                }
            }
        }
Esempio n. 2
0
        public void Gender()
        {
            lock (testLock)
            {
                // Get the code namespace for the schema.
                string inputFilePath = GetInputFilePath("Gender.xsd", Resources.Gender);

                var generatorParams = GetGeneratorParams(inputFilePath);
                generatorParams.TargetFramework = TargetFramework.Net30;
                generatorParams.PropertyParams.AutomaticProperties = true;
                generatorParams.GenerateDataContracts = true;
                generatorParams.Serialization.GenerateXmlAttributes = true;
                generatorParams.OutputFilePath = GetOutputFilePath(inputFilePath);

                var xsdGen = new GeneratorFacade(generatorParams);

                var result = xsdGen.Generate();

                Assert.IsTrue(result.Success, result.Messages.ToString());

                var genderRoot = new Root
                {
                    GenderAttribute          = ksgender.female,
                    GenderAttributeSpecified = true,
                    GenderElement            = ksgender.female,
                    GenderIntAttribute       = "toto"
                };
                Exception ex;
                genderRoot.SaveToFile(Path.Combine(OutputFolder, "gender.xml"), out ex);
                if (ex != null)
                {
                    throw ex;
                }

                var canCompile = CompileCSFile(generatorParams.OutputFilePath);
                Assert.IsTrue(canCompile.Success, canCompile.Messages.ToString());
            }
        }
Esempio n. 3
0
        public void Gender()
        {
            lock (testLock)
            {

                // Get the code namespace for the schema.
                string inputFilePath = GetInputFilePath("Gender.xsd", Resources.Gender);

                var generatorParams = GetGeneratorParams(inputFilePath);
                generatorParams.TargetFramework = TargetFramework.Net30;
                generatorParams.AutomaticProperties = true;
                generatorParams.GenerateDataContracts = true;
                generatorParams.GenerateXMLAttributes = true;
                generatorParams.OutputFilePath = GetOutputFilePath(inputFilePath);

                var xsdGen = new GeneratorFacade(generatorParams);

                var result = xsdGen.Generate();

                Assert.IsTrue(result.Success, result.Messages.ToString());

                var genderRoot = new Root
                                     {
                                         GenderAttribute = ksgender.female,
                                         GenderAttributeSpecified = true,
                                         GenderElement = ksgender.female,
                                         GenderIntAttribute = "toto"
                                     };
                Exception ex;
                genderRoot.SaveToFile(Path.Combine(OutputFolder, "gender.xml"), out ex);
                if(ex!=null) throw ex;

                var canCompile = CompileCSFile(generatorParams.OutputFilePath);
                Assert.IsTrue(canCompile.Success, canCompile.Messages.ToString());
            }
        }