annotate Agendas/trunk/src/Agendas.Tests/Cruds/PatrocinadorCrudNhTests.cs @ 147:5a1f7233aa5a

Agregando algunos tests
author Nelo@Guinea.neluz.int
date Mon, 01 Aug 2011 17:34:35 -0300
parents 2d1adbaf0373
children 5346c0500594
rev   line source
137
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
1 using Agendas.NHibernate;
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
2 using AltNetHispano.Agendas.Domain;
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
3 using AltNetHispano.Agendas.Repositories.NHibernate;
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
4 using Moq;
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
5 using NHibernate;
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
6 using NHibernate.Cfg;
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
7 using NHibernate.Tool.hbm2ddl;
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
8 using NUnit.Framework;
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
9
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
10 namespace AltNetHispano.Agendas.Tests.Cruds
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
11 {
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
12 [TestFixture]
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
13 public class PatrocinadorCrudNhTests
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
14 {
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
15 private PatrocinadorCrud _patrocinadorCrud;
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
16
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
17 #region SetUp
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
18
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
19 [SetUp]
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
20 public void BorrarRepositorios()
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
21 {
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
22 Configuration cfg = NhHelper.GetConfiguration();
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
23 var schemaExport = new SchemaExport(cfg);
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
24 schemaExport.Create(false, true);
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
25 }
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
26
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
27 [SetUp]
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
28 public void SetearUsuario()
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
29 {
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
30 var seguridad = new Mock<ISeguridad>();
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
31 seguridad.Setup(s => s.GetUserName()).Returns("neluz");
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
32 IdentityContext.Init(seguridad.Object, new PersonaRepository(NhHelper.GetSessionFactory()));
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
33 }
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
34
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
35 [SetUp]
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
36 public void CreateCrud()
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
37 {
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
38 ISessionFactory sessionFactory = NhHelper.GetSessionFactory();
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
39 _patrocinadorCrud = new PatrocinadorCrud(() => new PatrocinadorRepository(sessionFactory), () => new RequestEmulator(sessionFactory));
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
40 }
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
41
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
42 #endregion
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
43
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
44 [Test]
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
45 public void Create()
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
46 {
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
47 _patrocinadorCrud.Create();
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
48 }
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
49
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
50 [Test]
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
51 public void Read()
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
52 {
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
53 _patrocinadorCrud.Read();
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
54 }
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
55
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
56 [Test]
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
57 public void Update()
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
58 {
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
59 _patrocinadorCrud.Update();
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
60 }
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
61
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
62 [Test]
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
63 public void Delete()
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
64 {
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
65 _patrocinadorCrud.Delete();
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
66 }
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
67
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
68 }
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
69 }