diff Agendas/trunk/src/Agendas.Tests/Cruds/SchemaNhTests.cs @ 200:5346c0500594 deploy pre 1.0

Pasando a estructura de db fija, ya no se crea automáticamente. Se comenta lo referente a Patrocinadores que queda para alguna futura versión. Script para tablas de v1.0
author nelopauselli
date Wed, 17 Aug 2011 17:54:45 -0300
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Agendas/trunk/src/Agendas.Tests/Cruds/SchemaNhTests.cs	Wed Aug 17 17:54:45 2011 -0300
@@ -0,0 +1,61 @@
+using System;
+using System.Xml;
+using System.Xml.Serialization;
+using Agendas.NHibernate;
+using NHibernate.Cfg.MappingSchema;
+using NHibernate.Tool.hbm2ddl;
+using NUnit.Framework;
+
+namespace AltNetHispano.Agendas.Tests.Cruds
+{
+	[TestFixture]
+	public class SchemaNhTests
+	{
+		[Test]
+		public void ValidateSchema()
+		{
+			var cfg = NhHelper.GetConfiguration();
+
+			var schemaValidator = new SchemaValidator(cfg);
+			schemaValidator.Validate();
+		}
+
+		[Test]
+		public void BuildSessionFactory()
+		{
+			var cfg = NhHelper.GetConfiguration();
+
+			var sessionfactory = cfg.BuildSessionFactory();
+
+			Assert.IsNotNull(sessionfactory);
+		}
+
+		[Test]
+		public void ShowMapping()
+		{
+			var mapping = NhHelper.GetMapping();
+
+			var setting = new XmlWriterSettings { Indent = true };
+
+			var serializer = new XmlSerializer(typeof(HbmMapping));
+
+			var xw = XmlWriter.Create(Console.Out, setting);
+
+			serializer.Serialize(xw, mapping);
+		}
+
+		[Test]
+		public void LimpiarDb()
+		{
+			NhHelperTest.CleanDb();
+
+			var sf = NhHelper.GetSessionFactory();
+
+			var session = sf.OpenSession();
+
+			var query = session.CreateQuery("from System.Object");
+
+			Assert.IsEmpty(query.List());
+		}
+	}
+}
\ No newline at end of file