annotate Agendas/trunk/src/Agendas.Tests/Cruds/EventoCrudNhTests.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 3639803112c6
children
rev   line source
137
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents: 94
diff changeset
1 using Agendas.NHibernate;
63
963b71ea6028 Repositorios con NH
nelopauselli
parents:
diff changeset
2 using AltNetHispano.Agendas.Domain;
963b71ea6028 Repositorios con NH
nelopauselli
parents:
diff changeset
3 using AltNetHispano.Agendas.Repositories.NHibernate;
963b71ea6028 Repositorios con NH
nelopauselli
parents:
diff changeset
4 using Moq;
963b71ea6028 Repositorios con NH
nelopauselli
parents:
diff changeset
5 using NHibernate;
963b71ea6028 Repositorios con NH
nelopauselli
parents:
diff changeset
6 using NUnit.Framework;
963b71ea6028 Repositorios con NH
nelopauselli
parents:
diff changeset
7
963b71ea6028 Repositorios con NH
nelopauselli
parents:
diff changeset
8 namespace AltNetHispano.Agendas.Tests.Cruds
963b71ea6028 Repositorios con NH
nelopauselli
parents:
diff changeset
9 {
963b71ea6028 Repositorios con NH
nelopauselli
parents:
diff changeset
10 [TestFixture]
963b71ea6028 Repositorios con NH
nelopauselli
parents:
diff changeset
11 public class EventoCrudNhTests
963b71ea6028 Repositorios con NH
nelopauselli
parents:
diff changeset
12 {
963b71ea6028 Repositorios con NH
nelopauselli
parents:
diff changeset
13 private EventoCrud _eventoCrud;
963b71ea6028 Repositorios con NH
nelopauselli
parents:
diff changeset
14
963b71ea6028 Repositorios con NH
nelopauselli
parents:
diff changeset
15 #region SetUp
963b71ea6028 Repositorios con NH
nelopauselli
parents:
diff changeset
16
963b71ea6028 Repositorios con NH
nelopauselli
parents:
diff changeset
17 [SetUp]
963b71ea6028 Repositorios con NH
nelopauselli
parents:
diff changeset
18 public void BorrarRepositorios()
963b71ea6028 Repositorios con NH
nelopauselli
parents:
diff changeset
19 {
200
5346c0500594 Pasando a estructura de db fija, ya no se crea automáticamente.
nelopauselli
parents: 140
diff changeset
20 NhHelperTest.CleanDb();
63
963b71ea6028 Repositorios con NH
nelopauselli
parents:
diff changeset
21 }
963b71ea6028 Repositorios con NH
nelopauselli
parents:
diff changeset
22
963b71ea6028 Repositorios con NH
nelopauselli
parents:
diff changeset
23 [SetUp]
963b71ea6028 Repositorios con NH
nelopauselli
parents:
diff changeset
24 public void SetearUsuario()
963b71ea6028 Repositorios con NH
nelopauselli
parents:
diff changeset
25 {
963b71ea6028 Repositorios con NH
nelopauselli
parents:
diff changeset
26 var seguridad = new Mock<ISeguridad>();
963b71ea6028 Repositorios con NH
nelopauselli
parents:
diff changeset
27 seguridad.Setup(s => s.GetUserName()).Returns("neluz");
94
db4b1e2cae49 Cambio del nombre de la clase Ponente a Persona
Nelo@Kenia.neluz.int
parents: 67
diff changeset
28 IdentityContext.Init(seguridad.Object, new PersonaRepository(NhHelper.GetSessionFactory()));
63
963b71ea6028 Repositorios con NH
nelopauselli
parents:
diff changeset
29 }
963b71ea6028 Repositorios con NH
nelopauselli
parents:
diff changeset
30
963b71ea6028 Repositorios con NH
nelopauselli
parents:
diff changeset
31 [SetUp]
963b71ea6028 Repositorios con NH
nelopauselli
parents:
diff changeset
32 public void CreateCrud()
963b71ea6028 Repositorios con NH
nelopauselli
parents:
diff changeset
33 {
963b71ea6028 Repositorios con NH
nelopauselli
parents:
diff changeset
34 ISessionFactory sessionFactory=NhHelper.GetSessionFactory();
94
db4b1e2cae49 Cambio del nombre de la clase Ponente a Persona
Nelo@Kenia.neluz.int
parents: 67
diff changeset
35 _eventoCrud = new EventoCrud(() => new EventoRepository(sessionFactory), () => new PersonaRepository(sessionFactory),
63
963b71ea6028 Repositorios con NH
nelopauselli
parents:
diff changeset
36 () => new RequestEmulator(sessionFactory));
963b71ea6028 Repositorios con NH
nelopauselli
parents:
diff changeset
37 }
963b71ea6028 Repositorios con NH
nelopauselli
parents:
diff changeset
38
963b71ea6028 Repositorios con NH
nelopauselli
parents:
diff changeset
39 #endregion
963b71ea6028 Repositorios con NH
nelopauselli
parents:
diff changeset
40
963b71ea6028 Repositorios con NH
nelopauselli
parents:
diff changeset
41 [Test]
963b71ea6028 Repositorios con NH
nelopauselli
parents:
diff changeset
42 public void Create()
963b71ea6028 Repositorios con NH
nelopauselli
parents:
diff changeset
43 {
963b71ea6028 Repositorios con NH
nelopauselli
parents:
diff changeset
44 _eventoCrud.Create();
963b71ea6028 Repositorios con NH
nelopauselli
parents:
diff changeset
45 }
963b71ea6028 Repositorios con NH
nelopauselli
parents:
diff changeset
46
963b71ea6028 Repositorios con NH
nelopauselli
parents:
diff changeset
47 [Test]
963b71ea6028 Repositorios con NH
nelopauselli
parents:
diff changeset
48 public void Read()
963b71ea6028 Repositorios con NH
nelopauselli
parents:
diff changeset
49 {
963b71ea6028 Repositorios con NH
nelopauselli
parents:
diff changeset
50 _eventoCrud.Read();
963b71ea6028 Repositorios con NH
nelopauselli
parents:
diff changeset
51 }
963b71ea6028 Repositorios con NH
nelopauselli
parents:
diff changeset
52
963b71ea6028 Repositorios con NH
nelopauselli
parents:
diff changeset
53 [Test]
963b71ea6028 Repositorios con NH
nelopauselli
parents:
diff changeset
54 public void Update()
963b71ea6028 Repositorios con NH
nelopauselli
parents:
diff changeset
55 {
963b71ea6028 Repositorios con NH
nelopauselli
parents:
diff changeset
56 _eventoCrud.Update();
963b71ea6028 Repositorios con NH
nelopauselli
parents:
diff changeset
57 }
963b71ea6028 Repositorios con NH
nelopauselli
parents:
diff changeset
58
963b71ea6028 Repositorios con NH
nelopauselli
parents:
diff changeset
59 [Test]
963b71ea6028 Repositorios con NH
nelopauselli
parents:
diff changeset
60 public void Delete()
963b71ea6028 Repositorios con NH
nelopauselli
parents:
diff changeset
61 {
963b71ea6028 Repositorios con NH
nelopauselli
parents:
diff changeset
62 _eventoCrud.Delete();
963b71ea6028 Repositorios con NH
nelopauselli
parents:
diff changeset
63 }
140
3639803112c6 Refactoring de la relación entre Evento y Estado
nelopauselli
parents: 137
diff changeset
64
3639803112c6 Refactoring de la relación entre Evento y Estado
nelopauselli
parents: 137
diff changeset
65 [Test]
3639803112c6 Refactoring de la relación entre Evento y Estado
nelopauselli
parents: 137
diff changeset
66 public void Workflow()
3639803112c6 Refactoring de la relación entre Evento y Estado
nelopauselli
parents: 137
diff changeset
67 {
3639803112c6 Refactoring de la relación entre Evento y Estado
nelopauselli
parents: 137
diff changeset
68 _eventoCrud.Workflow();
3639803112c6 Refactoring de la relación entre Evento y Estado
nelopauselli
parents: 137
diff changeset
69 }
63
963b71ea6028 Repositorios con NH
nelopauselli
parents:
diff changeset
70
963b71ea6028 Repositorios con NH
nelopauselli
parents:
diff changeset
71 }
963b71ea6028 Repositorios con NH
nelopauselli
parents:
diff changeset
72 }