view Agendas/trunk/src/Agendas.Repositories.Tests/SchemaNhTests.cs @ 288:a6037c6c88d8

Se soluciona bug #198 Bug: Summary incorrecto en Google Calendar. Se parametriza la hora en el mensaje.
author user@MECHUQUE
date Mon, 30 Jan 2012 01:52:47 -0300
parents 68b09c30b0d2
children
line wrap: on
line source

using System;
using System.Xml;
using System.Xml.Serialization;
using Agendas.NHibernate;
using Agendas.Repositories.Tests.Infraestructure;
using NHibernate.Cfg.MappingSchema;
using NHibernate.Tool.hbm2ddl;
using NUnit.Framework;

namespace Agendas.Repositories.Tests
{
	[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());
		}
	}
}