annotate Agendas/trunk/src/Agendas.Repositories.Tests/PatrocinadorCrudNhTests.cs @ 298:9bc60d166c8a

Se corrigieron los tests por el cambio de Patrocinador, para que no persista el logo en disco. Se comentó el código de PatrocinadorApiController, que no se utiliza.
author juanjose.montesdeocaarbos
date Sun, 19 Feb 2012 16:00:38 -0300
parents 72a96459f910
children
rev   line source
274
72a96459f910 Ticket #123: Patrocinadores de las vans.
juanjose.montesdeocaarbos
parents: 222
diff changeset
1 using Agendas.NHibernate;
72a96459f910 Ticket #123: Patrocinadores de las vans.
juanjose.montesdeocaarbos
parents: 222
diff changeset
2 using Agendas.Repositories.Tests.Infraestructure;
72a96459f910 Ticket #123: Patrocinadores de las vans.
juanjose.montesdeocaarbos
parents: 222
diff changeset
3 using AltNetHispano.Agendas.Domain;
72a96459f910 Ticket #123: Patrocinadores de las vans.
juanjose.montesdeocaarbos
parents: 222
diff changeset
4 using AltNetHispano.Agendas.Repositories.NHibernate;
72a96459f910 Ticket #123: Patrocinadores de las vans.
juanjose.montesdeocaarbos
parents: 222
diff changeset
5 using Moq;
72a96459f910 Ticket #123: Patrocinadores de las vans.
juanjose.montesdeocaarbos
parents: 222
diff changeset
6 using NHibernate;
72a96459f910 Ticket #123: Patrocinadores de las vans.
juanjose.montesdeocaarbos
parents: 222
diff changeset
7 using NUnit.Framework;
72a96459f910 Ticket #123: Patrocinadores de las vans.
juanjose.montesdeocaarbos
parents: 222
diff changeset
8
72a96459f910 Ticket #123: Patrocinadores de las vans.
juanjose.montesdeocaarbos
parents: 222
diff changeset
9 namespace Agendas.Repositories.Tests
137
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
10 {
274
72a96459f910 Ticket #123: Patrocinadores de las vans.
juanjose.montesdeocaarbos
parents: 222
diff changeset
11 [TestFixture]
72a96459f910 Ticket #123: Patrocinadores de las vans.
juanjose.montesdeocaarbos
parents: 222
diff changeset
12 public class PatrocinadorCrudNhTests
72a96459f910 Ticket #123: Patrocinadores de las vans.
juanjose.montesdeocaarbos
parents: 222
diff changeset
13 {
72a96459f910 Ticket #123: Patrocinadores de las vans.
juanjose.montesdeocaarbos
parents: 222
diff changeset
14 private PatrocinadorCrud _patrocinadorCrud;
200
5346c0500594 Pasando a estructura de db fija, ya no se crea automáticamente.
nelopauselli
parents: 137
diff changeset
15
274
72a96459f910 Ticket #123: Patrocinadores de las vans.
juanjose.montesdeocaarbos
parents: 222
diff changeset
16 #region SetUp
72a96459f910 Ticket #123: Patrocinadores de las vans.
juanjose.montesdeocaarbos
parents: 222
diff changeset
17
72a96459f910 Ticket #123: Patrocinadores de las vans.
juanjose.montesdeocaarbos
parents: 222
diff changeset
18 [SetUp]
72a96459f910 Ticket #123: Patrocinadores de las vans.
juanjose.montesdeocaarbos
parents: 222
diff changeset
19 public void BorrarRepositorios()
72a96459f910 Ticket #123: Patrocinadores de las vans.
juanjose.montesdeocaarbos
parents: 222
diff changeset
20 {
72a96459f910 Ticket #123: Patrocinadores de las vans.
juanjose.montesdeocaarbos
parents: 222
diff changeset
21 NhHelperTest.CleanDb();
72a96459f910 Ticket #123: Patrocinadores de las vans.
juanjose.montesdeocaarbos
parents: 222
diff changeset
22 }
137
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
23
274
72a96459f910 Ticket #123: Patrocinadores de las vans.
juanjose.montesdeocaarbos
parents: 222
diff changeset
24 [SetUp]
72a96459f910 Ticket #123: Patrocinadores de las vans.
juanjose.montesdeocaarbos
parents: 222
diff changeset
25 public void SetearUsuario()
72a96459f910 Ticket #123: Patrocinadores de las vans.
juanjose.montesdeocaarbos
parents: 222
diff changeset
26 {
72a96459f910 Ticket #123: Patrocinadores de las vans.
juanjose.montesdeocaarbos
parents: 222
diff changeset
27 var seguridad = new Mock<ISeguridad>();
72a96459f910 Ticket #123: Patrocinadores de las vans.
juanjose.montesdeocaarbos
parents: 222
diff changeset
28 seguridad.Setup(s => s.GetUserName()).Returns("neluz");
72a96459f910 Ticket #123: Patrocinadores de las vans.
juanjose.montesdeocaarbos
parents: 222
diff changeset
29 IdentityContext.Init(seguridad.Object, new PersonaRepository(NhHelper.GetSessionFactory()));
72a96459f910 Ticket #123: Patrocinadores de las vans.
juanjose.montesdeocaarbos
parents: 222
diff changeset
30 }
137
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
31
274
72a96459f910 Ticket #123: Patrocinadores de las vans.
juanjose.montesdeocaarbos
parents: 222
diff changeset
32 [SetUp]
72a96459f910 Ticket #123: Patrocinadores de las vans.
juanjose.montesdeocaarbos
parents: 222
diff changeset
33 public void CreateCrud()
72a96459f910 Ticket #123: Patrocinadores de las vans.
juanjose.montesdeocaarbos
parents: 222
diff changeset
34 {
72a96459f910 Ticket #123: Patrocinadores de las vans.
juanjose.montesdeocaarbos
parents: 222
diff changeset
35 ISessionFactory sessionFactory = NhHelper.GetSessionFactory();
72a96459f910 Ticket #123: Patrocinadores de las vans.
juanjose.montesdeocaarbos
parents: 222
diff changeset
36 _patrocinadorCrud = new PatrocinadorCrud(() => new PatrocinadorRepository(sessionFactory), () => new RequestEmulator(sessionFactory));
72a96459f910 Ticket #123: Patrocinadores de las vans.
juanjose.montesdeocaarbos
parents: 222
diff changeset
37 }
137
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
38
274
72a96459f910 Ticket #123: Patrocinadores de las vans.
juanjose.montesdeocaarbos
parents: 222
diff changeset
39 #endregion
137
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
40
274
72a96459f910 Ticket #123: Patrocinadores de las vans.
juanjose.montesdeocaarbos
parents: 222
diff changeset
41 [Test]
72a96459f910 Ticket #123: Patrocinadores de las vans.
juanjose.montesdeocaarbos
parents: 222
diff changeset
42 public void Create()
72a96459f910 Ticket #123: Patrocinadores de las vans.
juanjose.montesdeocaarbos
parents: 222
diff changeset
43 {
72a96459f910 Ticket #123: Patrocinadores de las vans.
juanjose.montesdeocaarbos
parents: 222
diff changeset
44 _patrocinadorCrud.Create();
72a96459f910 Ticket #123: Patrocinadores de las vans.
juanjose.montesdeocaarbos
parents: 222
diff changeset
45 }
137
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
46
274
72a96459f910 Ticket #123: Patrocinadores de las vans.
juanjose.montesdeocaarbos
parents: 222
diff changeset
47 [Test]
72a96459f910 Ticket #123: Patrocinadores de las vans.
juanjose.montesdeocaarbos
parents: 222
diff changeset
48 public void Read()
72a96459f910 Ticket #123: Patrocinadores de las vans.
juanjose.montesdeocaarbos
parents: 222
diff changeset
49 {
72a96459f910 Ticket #123: Patrocinadores de las vans.
juanjose.montesdeocaarbos
parents: 222
diff changeset
50 _patrocinadorCrud.Read();
72a96459f910 Ticket #123: Patrocinadores de las vans.
juanjose.montesdeocaarbos
parents: 222
diff changeset
51 }
137
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
52
274
72a96459f910 Ticket #123: Patrocinadores de las vans.
juanjose.montesdeocaarbos
parents: 222
diff changeset
53 [Test]
72a96459f910 Ticket #123: Patrocinadores de las vans.
juanjose.montesdeocaarbos
parents: 222
diff changeset
54 public void Update()
72a96459f910 Ticket #123: Patrocinadores de las vans.
juanjose.montesdeocaarbos
parents: 222
diff changeset
55 {
72a96459f910 Ticket #123: Patrocinadores de las vans.
juanjose.montesdeocaarbos
parents: 222
diff changeset
56 _patrocinadorCrud.Update();
72a96459f910 Ticket #123: Patrocinadores de las vans.
juanjose.montesdeocaarbos
parents: 222
diff changeset
57 }
137
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
58
274
72a96459f910 Ticket #123: Patrocinadores de las vans.
juanjose.montesdeocaarbos
parents: 222
diff changeset
59 [Test]
72a96459f910 Ticket #123: Patrocinadores de las vans.
juanjose.montesdeocaarbos
parents: 222
diff changeset
60 public void Delete()
72a96459f910 Ticket #123: Patrocinadores de las vans.
juanjose.montesdeocaarbos
parents: 222
diff changeset
61 {
72a96459f910 Ticket #123: Patrocinadores de las vans.
juanjose.montesdeocaarbos
parents: 222
diff changeset
62 _patrocinadorCrud.Delete();
72a96459f910 Ticket #123: Patrocinadores de las vans.
juanjose.montesdeocaarbos
parents: 222
diff changeset
63 }
137
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
64
274
72a96459f910 Ticket #123: Patrocinadores de las vans.
juanjose.montesdeocaarbos
parents: 222
diff changeset
65 }
137
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
66 }