comparison Agendas/trunk/src/Agendas.Tests/Cruds/PatrocinadorCrudNhTests.cs @ 137:2d1adbaf0373

CRUD de Patrocinador
author nelopauselli
date Thu, 28 Jul 2011 09:26:24 -0300
parents
children 5346c0500594
comparison
equal deleted inserted replaced
136:462a78196d11 137:2d1adbaf0373
1 using Agendas.NHibernate;
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 PatrocinadorCrudNhTests
14 {
15 private PatrocinadorCrud _patrocinadorCrud;
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");
32 IdentityContext.Init(seguridad.Object, new PersonaRepository(NhHelper.GetSessionFactory()));
33 }
34
35 [SetUp]
36 public void CreateCrud()
37 {
38 ISessionFactory sessionFactory = NhHelper.GetSessionFactory();
39 _patrocinadorCrud = new PatrocinadorCrud(() => new PatrocinadorRepository(sessionFactory), () => new RequestEmulator(sessionFactory));
40 }
41
42 #endregion
43
44 [Test]
45 public void Create()
46 {
47 _patrocinadorCrud.Create();
48 }
49
50 [Test]
51 public void Read()
52 {
53 _patrocinadorCrud.Read();
54 }
55
56 [Test]
57 public void Update()
58 {
59 _patrocinadorCrud.Update();
60 }
61
62 [Test]
63 public void Delete()
64 {
65 _patrocinadorCrud.Delete();
66 }
67
68 }
69 }