comparison Agendas/trunk/src/Agendas.Tests/Cruds/PersonaCrudNhTests.cs @ 178:33e57fd1a6c9

Roles: en dominio y autoregistración
author nelopauselli
date Mon, 08 Aug 2011 12:30:37 -0300
parents
children 5346c0500594
comparison
equal deleted inserted replaced
177:784d81e32366 178:33e57fd1a6c9
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 PersonaCrudNhTests : IPersonaCrudTest
14 {
15 private PersonaCrud _test;
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 _test = new PersonaCrud(() => new PersonaRepository(sessionFactory), () => new RequestEmulator(sessionFactory));
40 }
41
42 #endregion
43
44 [Test]
45 public void CreateAdministrador()
46 {
47 _test.CreateAdministrador();
48 }
49
50 [Test]
51 public void ReadAdministrador()
52 {
53 _test.ReadAdministrador();
54 }
55
56 [Test]
57 public void CreateUsuario()
58 {
59 _test.CreateUsuario();
60 }
61
62 [Test]
63 public void ReadUsuario()
64 {
65 _test.ReadUsuario();
66 }
67
68 [Test]
69 public void Update()
70 {
71 _test.Update();
72 }
73 }
74 }