comparison Agendas/trunk/src/Agendas.Repositories.Tests/SchemaNhTests.cs @ 222:68b09c30b0d2

Separando los test de persistencia en un proyecto aparte
author nelopauselli
date Mon, 19 Sep 2011 18:18:17 -0300
parents Agendas/trunk/src/Agendas.Tests/Cruds/SchemaNhTests.cs@5346c0500594
children
comparison
equal deleted inserted replaced
221:37ddf81333d3 222:68b09c30b0d2
1 using System;
2 using System.Xml;
3 using System.Xml.Serialization;
4 using Agendas.NHibernate;
5 using Agendas.Repositories.Tests.Infraestructure;
6 using NHibernate.Cfg.MappingSchema;
7 using NHibernate.Tool.hbm2ddl;
8 using NUnit.Framework;
9
10 namespace Agendas.Repositories.Tests
11 {
12 [TestFixture]
13 public class SchemaNhTests
14 {
15 [Test]
16 public void ValidateSchema()
17 {
18 var cfg = NhHelper.GetConfiguration();
19
20 var schemaValidator = new SchemaValidator(cfg);
21 schemaValidator.Validate();
22 }
23
24 [Test]
25 public void BuildSessionFactory()
26 {
27 var cfg = NhHelper.GetConfiguration();
28
29 var sessionfactory = cfg.BuildSessionFactory();
30
31 Assert.IsNotNull(sessionfactory);
32 }
33
34 [Test]
35 public void ShowMapping()
36 {
37 var mapping = NhHelper.GetMapping();
38
39 var setting = new XmlWriterSettings { Indent = true };
40
41 var serializer = new XmlSerializer(typeof(HbmMapping));
42
43 var xw = XmlWriter.Create(Console.Out, setting);
44
45 serializer.Serialize(xw, mapping);
46 }
47
48 [Test]
49 public void LimpiarDb()
50 {
51 NhHelperTest.CleanDb();
52
53 var sf = NhHelper.GetSessionFactory();
54
55 var session = sf.OpenSession();
56
57 var query = session.CreateQuery("from System.Object");
58
59 Assert.IsEmpty(query.List());
60 }
61 }
62 }