Mercurial > altnet-hispano
view Agendas/trunk/src/Agendas.Tests/Cruds/EventoCrudNhTests.cs @ 179:1deccd6c3cb2
Aplicando seguridad x roles en sitio web
author | nelopauselli |
---|---|
date | Mon, 08 Aug 2011 15:24:26 -0300 |
parents | 3639803112c6 |
children | 5346c0500594 |
line wrap: on
line source
using Agendas.NHibernate; using AltNetHispano.Agendas.Domain; using AltNetHispano.Agendas.Repositories.NHibernate; using Moq; using NHibernate; using NHibernate.Cfg; using NHibernate.Tool.hbm2ddl; using NUnit.Framework; namespace AltNetHispano.Agendas.Tests.Cruds { [TestFixture] public class EventoCrudNhTests { private EventoCrud _eventoCrud; #region SetUp [SetUp] public void BorrarRepositorios() { Configuration cfg =NhHelper.GetConfiguration(); var schemaExport = new SchemaExport(cfg); schemaExport.Create(false, true); } [SetUp] public void SetearUsuario() { var seguridad = new Mock<ISeguridad>(); seguridad.Setup(s => s.GetUserName()).Returns("neluz"); IdentityContext.Init(seguridad.Object, new PersonaRepository(NhHelper.GetSessionFactory())); } [SetUp] public void CreateCrud() { ISessionFactory sessionFactory=NhHelper.GetSessionFactory(); _eventoCrud = new EventoCrud(() => new EventoRepository(sessionFactory), () => new PersonaRepository(sessionFactory), () => new RequestEmulator(sessionFactory)); } #endregion [Test] public void Create() { _eventoCrud.Create(); } [Test] public void Read() { _eventoCrud.Read(); } [Test] public void Update() { _eventoCrud.Update(); } [Test] public void Delete() { _eventoCrud.Delete(); } [Test] public void Workflow() { _eventoCrud.Workflow(); } } }