comparison 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
comparison
equal deleted inserted replaced
199:39ce09df76dc 200:5346c0500594
1 using System;
2 using System.Xml;
3 using System.Xml.Serialization;
4 using Agendas.NHibernate;
5 using NHibernate.Cfg.MappingSchema;
6 using NHibernate.Tool.hbm2ddl;
7 using NUnit.Framework;
8
9 namespace AltNetHispano.Agendas.Tests.Cruds
10 {
11 [TestFixture]
12 public class SchemaNhTests
13 {
14 [Test]
15 public void ValidateSchema()
16 {
17 var cfg = NhHelper.GetConfiguration();
18
19 var schemaValidator = new SchemaValidator(cfg);
20 schemaValidator.Validate();
21 }
22
23 [Test]
24 public void BuildSessionFactory()
25 {
26 var cfg = NhHelper.GetConfiguration();
27
28 var sessionfactory = cfg.BuildSessionFactory();
29
30 Assert.IsNotNull(sessionfactory);
31 }
32
33 [Test]
34 public void ShowMapping()
35 {
36 var mapping = NhHelper.GetMapping();
37
38 var setting = new XmlWriterSettings { Indent = true };
39
40 var serializer = new XmlSerializer(typeof(HbmMapping));
41
42 var xw = XmlWriter.Create(Console.Out, setting);
43
44 serializer.Serialize(xw, mapping);
45 }
46
47 [Test]
48 public void LimpiarDb()
49 {
50 NhHelperTest.CleanDb();
51
52 var sf = NhHelper.GetSessionFactory();
53
54 var session = sf.OpenSession();
55
56 var query = session.CreateQuery("from System.Object");
57
58 Assert.IsEmpty(query.List());
59 }
60 }
61 }