Mercurial > altnet-hispano
annotate Agendas/trunk/src/Agendas.Tests/Cruds/EventoCrudNhTests.cs @ 137:2d1adbaf0373
CRUD de Patrocinador
author | nelopauselli |
---|---|
date | Thu, 28 Jul 2011 09:26:24 -0300 |
parents | db4b1e2cae49 |
children | 3639803112c6 |
rev | line source |
---|---|
137 | 1 using Agendas.NHibernate; |
63 | 2 using AltNetHispano.Agendas.Domain; |
3 using AltNetHispano.Agendas.Repositories.NHibernate; | |
4 using Moq; | |
5 using NHibernate; | |
6 using NHibernate.Cfg; | |
7 using NHibernate.Tool.hbm2ddl; | |
8 using NUnit.Framework; | |
9 | |
10 namespace AltNetHispano.Agendas.Tests.Cruds | |
11 { | |
12 [TestFixture] | |
13 public class EventoCrudNhTests | |
14 { | |
15 private EventoCrud _eventoCrud; | |
16 | |
17 #region SetUp | |
18 | |
19 [SetUp] | |
20 public void BorrarRepositorios() | |
21 { | |
22 Configuration cfg =NhHelper.GetConfiguration(); | |
23 var schemaExport = new SchemaExport(cfg); | |
24 schemaExport.Create(false, true); | |
25 } | |
26 | |
27 [SetUp] | |
28 public void SetearUsuario() | |
29 { | |
30 var seguridad = new Mock<ISeguridad>(); | |
31 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
|
32 IdentityContext.Init(seguridad.Object, new PersonaRepository(NhHelper.GetSessionFactory())); |
63 | 33 } |
34 | |
35 [SetUp] | |
36 public void CreateCrud() | |
37 { | |
38 ISessionFactory sessionFactory=NhHelper.GetSessionFactory(); | |
94
db4b1e2cae49
Cambio del nombre de la clase Ponente a Persona
Nelo@Kenia.neluz.int
parents:
67
diff
changeset
|
39 _eventoCrud = new EventoCrud(() => new EventoRepository(sessionFactory), () => new PersonaRepository(sessionFactory), |
63 | 40 () => new RequestEmulator(sessionFactory)); |
41 } | |
42 | |
43 #endregion | |
44 | |
45 [Test] | |
46 public void Create() | |
47 { | |
48 _eventoCrud.Create(); | |
49 } | |
50 | |
51 [Test] | |
52 public void Read() | |
53 { | |
54 _eventoCrud.Read(); | |
55 } | |
56 | |
57 [Test] | |
58 public void Update() | |
59 { | |
60 _eventoCrud.Update(); | |
61 } | |
62 | |
63 [Test] | |
64 public void Delete() | |
65 { | |
66 _eventoCrud.Delete(); | |
67 } | |
68 | |
69 } | |
70 } |