コード例 #1
0
        public void ShouldGenerateWithXmlSerializerImporterFromAttribute()
        {
            MyArtifactLinkWithXmlImporterFromAttribute link     = new MyArtifactLinkWithXmlImporterFromAttribute("SampleData\\SimpleSchema1.xsd", "element1");
            XmlSchemaCodeGenerationStrategy            strategy = new XmlSchemaCodeGenerationStrategy();
            CodeGenerationResults content = strategy.Generate(link);

            Assert.AreEqual <int>(3, content.Count);
            Assert.AreEqual <int>(0, strategy.Errors.Count);
            CompilerResults results = DynamicCompilation.CompileAssemblyFromSource(JoinContent(content), ((List <string>)strategy.AssemblyReferences).ToArray());

            TypeAsserter.AssertAttribute <XmlRootAttribute>(results.CompiledAssembly.GetType("element1"));
        }
コード例 #2
0
		public void ShouldGenerateWithXmlSerializerImporterFromAttribute()
		{
			MyArtifactLinkWithXmlImporterFromAttribute link = new MyArtifactLinkWithXmlImporterFromAttribute("SampleData\\SimpleSchema1.xsd", "element1");
			XmlSchemaCodeGenerationStrategy strategy = new XmlSchemaCodeGenerationStrategy();
			CodeGenerationResults content = strategy.Generate(link);

			Assert.AreEqual<int>(3, content.Count);
			Assert.AreEqual<int>(0, strategy.Errors.Count);
			CompilerResults results = DynamicCompilation.CompileAssemblyFromSource(JoinContent(content), ((List<string>)strategy.AssemblyReferences).ToArray());
			TypeAsserter.AssertAttribute<XmlRootAttribute>(results.CompiledAssembly.GetType("element1"));
		}