<commit_before>using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using NHibernate.Cfg;
using NHibernate.Criterion;
using NHibernate.Engine;
using NHibernate.Tool.hbm2ddl;
using NUnit.Framework;

namespace NHibernate.Test.NHSpecificTest.NH1274ExportExclude
{
	[TestFixture]
	public class NH1274ExportExcludeFixture
	{

		[Test]
		public void SchemaExport_Drop_CreatesDropScript()
		{
			Configuration configuration = GetConfiguration();
			SchemaExport export = new SchemaExport(configuration);
			TextWriter tw = new StringWriter();
			Console.SetOut(tw);
			export.Drop(true, false);
			string s = tw.ToString();
			Assert.IsTrue(s.Contains("drop table Home_Drop"));
			Assert.IsTrue(s.Contains("drop table Home_All"));
		}

		[Test]
		public void SchemaExport_Export_CreatesExportScript()
		{
			Configuration configuration = GetConfiguration();
			SchemaExport export = new SchemaExport(configuration);
			TextWriter tw = new StringWriter();
			Console.SetOut(tw);
			export.Create(true, false);
			string s = tw.ToString();
			Assert.IsTrue(s.Contains("drop table Home_Drop"));
			Assert.IsTrue(s.Contains("drop table Home_All"));
			Assert.IsTrue(s.Contains("create table Home_All"));
			Assert.IsTrue(s.Contains("create table Home_Export"));
		}

		[Test]
		public void SchemaExport_Update_CreatesUpdateScript()
		{
			Configuration configuration = GetConfiguration();
			SchemaUpdate update = new SchemaUpdate(configuration);
			TextWriter tw = new StringWriter();
			Console.SetOut(tw);
			update.Execute(true, false);

			string s = tw.ToString();
			Assert.IsTrue(s.Contains("create table Home_Update"));
			Assert.IsTrue(s.Contains("create table Home_All"));
		}

		[Test]
		public void SchemaExport_Validate_CausesValidateException()
		{
			Configuration configuration = GetConfiguration();
			SchemaValidator validator = new SchemaValidator(configuration);
			try
			{
				validator.Validate();
			}
			catch (HibernateException he)
			{
				Assert.IsTrue(he.Message.Contains("Home_Validate"));
				return;
			}
			throw new Exception("Should not get to this exception");
		}

		private Configuration GetConfiguration()
		{
			Configuration cfg = new Configuration();
			if (TestConfigurationHelper.hibernateConfigFile != null)
				cfg.Configure(TestConfigurationHelper.hibernateConfigFile);

			Assembly assembly = Assembly.Load(MappingsAssembly);

			foreach (string file in Mappings)
			{
				cfg.AddResource(MappingsAssembly + "." + file, assembly);
			}
			return cfg;
		}


		protected static string MappingsAssembly
		{
			get { return "NHibernate.Test"; }
		}

		public virtual string BugNumber
		{
			get
			{
				string ns = GetType().Namespace;
				return ns.Substring(ns.LastIndexOf('.') + 1);
			}
		}

		protected IList Mappings
		{
			get
			{
				return new string[]
					{
						"NHSpecificTest." + BugNumber + ".Mappings.hbm.xml"
					};
			}
		}
	}
}<commit_msg>Test passing for dialect supporting SupportsIfExistsBeforeTableName (Postgres)<commit_after>using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using NHibernate.Cfg;
using NHibernate.Criterion;
using NHibernate.Engine;
using NHibernate.Tool.hbm2ddl;
using NUnit.Framework;

namespace NHibernate.Test.NHSpecificTest.NH1274ExportExclude
{
	[TestFixture]
	public class NH1274ExportExcludeFixture
	{
		[Test]
		public void SchemaExport_Drop_CreatesDropScript()
		{
			Configuration configuration = GetConfiguration();
			SchemaExport export = new SchemaExport(configuration);
			TextWriter tw = new StringWriter();
			Console.SetOut(tw);
			export.Drop(true, false);
			string s = tw.ToString();

			var dialect = Dialect.Dialect.GetDialect(configuration.Properties);

			if (dialect.SupportsIfExistsBeforeTableName)
			{
				Assert.IsTrue(s.Contains("drop table if exists Home_Drop"));
				Assert.IsTrue(s.Contains("drop table if exists Home_All"));
			}
			else
			{
				Assert.IsTrue(s.Contains("drop table Home_Drop"));
				Assert.IsTrue(s.Contains("drop table Home_All"));
			}
		}

		[Test]
		public void SchemaExport_Export_CreatesExportScript()
		{
			Configuration configuration = GetConfiguration();
			SchemaExport export = new SchemaExport(configuration);
			TextWriter tw = new StringWriter();
			Console.SetOut(tw);
			export.Create(true, false);
			string s = tw.ToString();
			
			var dialect = Dialect.Dialect.GetDialect(configuration.Properties);
			if (dialect.SupportsIfExistsBeforeTableName)
			{
				Assert.IsTrue(s.Contains("drop table if exists Home_Drop"));
				Assert.IsTrue(s.Contains("drop table if exists Home_All"));
			}
			else
			{
				Assert.IsTrue(s.Contains("drop table Home_Drop"));
				Assert.IsTrue(s.Contains("drop table Home_All"));
			}

			Assert.IsTrue(s.Contains("create table Home_All"));
			Assert.IsTrue(s.Contains("create table Home_Export"));
		}

		[Test]
		public void SchemaExport_Update_CreatesUpdateScript()
		{
			Configuration configuration = GetConfiguration();
			SchemaUpdate update = new SchemaUpdate(configuration);
			TextWriter tw = new StringWriter();
			Console.SetOut(tw);
			update.Execute(true, false);

			string s = tw.ToString();
			Assert.IsTrue(s.Contains("create table Home_Update"));
			Assert.IsTrue(s.Contains("create table Home_All"));
		}

		[Test]
		public void SchemaExport_Validate_CausesValidateException()
		{
			Configuration configuration = GetConfiguration();
			SchemaValidator validator = new SchemaValidator(configuration);
			try
			{
				validator.Validate();
			}
			catch (HibernateException he)
			{
				Assert.IsTrue(he.Message.Contains("Home_Validate"));
				return;
			}
			throw new Exception("Should not get to this exception");
		}

		private Configuration GetConfiguration()
		{
			Configuration cfg = new Configuration();
			if (TestConfigurationHelper.hibernateConfigFile != null)
				cfg.Configure(TestConfigurationHelper.hibernateConfigFile);

			Assembly assembly = Assembly.Load(MappingsAssembly);

			foreach (string file in Mappings)
			{
				cfg.AddResource(MappingsAssembly + "." + file, assembly);
			}
			return cfg;
		}


		protected static string MappingsAssembly
		{
			get { return "NHibernate.Test"; }
		}

		public virtual string BugNumber
		{
			get
			{
				string ns = GetType().Namespace;
				return ns.Substring(ns.LastIndexOf('.') + 1);
			}
		}

		protected IList Mappings
		{
			get
			{
				return new string[]
					{
						"NHSpecificTest." + BugNumber + ".Mappings.hbm.xml"
					};
			}
		}
	}
}
{'fraction_non_alphanumeric': 0.10555718906204058, 'fraction_numerical': 0.002940311673037342, 'mean_word_length': 3.4290364583333335, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5567167', 'n_tokens_mistral': 2429, 'n_tokens_neox': 1947, 'n_words': 420}