private static void TestGeneratedXml(string classFileName, string xmlFileName, string contentTypeName, ParserFactory factory)
        {
            ContentType contentType;
            string expectedOutput;

            using (var goldReader = File.OpenText(@"..\..\TestFiles\" + xmlFileName + ".xml"))
            {
                expectedOutput = goldReader.ReadToEnd();
            }

            var contentTypeConfig = CodeGeneratorConfiguration.Create().Get(contentTypeName);
            contentTypeConfig.BaseClass = "Umbraco.Core.Models.TypedModelBase";

            using (var inputReader = File.OpenText(@"..\..\TestFiles\" + classFileName + ".cs"))
            {
                var codeParser = new CodeParser(contentTypeConfig, TestDataTypeProvider.All, factory);
                contentType = codeParser.Parse(inputReader).Single();
            }

            var serializer = new ContentTypeSerializer();
            var xml = serializer.Serialize(contentType);

            Console.WriteLine(xml);

            Assert.AreEqual(expectedOutput, xml);
        }
		private static void TestBuildCode(string fileName, string contentTypeName)
		{
		    ContentType contentType;
			var expectedOutput = "";
			using (var inputReader = File.OpenText(@"..\..\TestFiles\" + fileName + ".xml"))
			{
                contentType = new ContentTypeSerializer().Deserialize(inputReader);
            }
            using (var goldReader = File.OpenText(@"..\..\TestFiles\" + fileName + ".cs"))
			{
				expectedOutput = goldReader.ReadToEnd();
			}

			var configuration = new CodeGeneratorConfiguration();
		    configuration.TypeMappings.Add(new TypeMapping("1413afcb-d19a-4173-8e9a-68288d2a73b8", "Int32"));
		    var typeConfig = configuration.Get(contentTypeName);
		    typeConfig.BaseClass = "DocumentTypeBase";
		    typeConfig.Namespace = "Umbraco.CodeGen.Models";

		    var sb = new StringBuilder();
			var writer = new StringWriter(sb);

		    var factory = new DefaultCodeGeneratorFactory();
		    var dataTypeProvider = new TestDataTypeProvider();
		    var generator = new CodeGenerator(typeConfig, dataTypeProvider, factory);
		    generator.Generate(contentType, writer);

            writer.Flush();
            Console.WriteLine(sb.ToString());

			Assert.AreEqual(expectedOutput, sb.ToString());
		}
        protected void TestBuildCode(string classFileName, string xmlFileName, string contentTypeName)
        {
            ContentType contentType;
            var expectedOutput = "";
            using (var inputReader = File.OpenText(@"..\..\TestFiles\" + xmlFileName + ".xml"))
            {
                contentType = new ContentTypeSerializer().Deserialize(inputReader);
            }
            using (var goldReader = File.OpenText(@"..\..\TestFiles\" + classFileName + ".cs"))
            {
                expectedOutput = goldReader.ReadToEnd();
            }

            var configuration = CodeGeneratorConfiguration.Create();
            var typeConfig = configuration.Get(contentTypeName);
            typeConfig.BaseClass = "Umbraco.Core.Models.TypedModelBase";
            typeConfig.Namespace = "Umbraco.CodeGen.Models";

            configuration.TypeMappings.Add(new TypeMapping("Umbraco.Integer", "Int32"));

            OnConfiguring(configuration, contentTypeName);

            var sb = new StringBuilder();
            var writer = new StringWriter(sb);

            var dataTypeProvider = new TestDataTypeProvider();
            var generator = new CodeGenerator(typeConfig, dataTypeProvider, CreateGeneratorFactory());

            generator.Generate(contentType, writer);

            writer.Flush();
            Console.WriteLine(sb.ToString());

            Assert.AreEqual(expectedOutput, sb.ToString());
        }
		private static void TestGeneratedXml(string fileName, string contentTypeName)
		{
			ContentType contentType;
			string expectedOutput;

            using (var goldReader = File.OpenText(@"..\..\TestFiles\" + fileName + ".xml"))
			{
				expectedOutput = goldReader.ReadToEnd();
			}

		    var contentTypeConfig = new CodeGeneratorConfiguration().Get(contentTypeName);
		    contentTypeConfig.BaseClass = "DocumentTypeBase";

            using (var inputReader = File.OpenText(@"..\..\TestFiles\" + fileName + ".cs"))
			{
                var codeParser = new CodeParser(contentTypeConfig, TestDataTypeProvider.All, new DefaultParserFactory());
			    contentType = codeParser.Parse(inputReader).Single();
			}
            
		    var serializer = new ContentTypeSerializer();
		    var xml = serializer.Serialize(contentType);

            Console.WriteLine(xml);

		    Assert.AreEqual(expectedOutput, xml);
		}