view Agendas/trunk/src/Agendas.Tests/TestBase.cs @ 63:963b71ea6028

Repositorios con NH
author nelopauselli
date Tue, 17 May 2011 14:02:25 -0300
parents 3059a5f8930f
children db4b1e2cae49
line wrap: on
line source

using AltNetHispano.Agendas.Domain;
using AltNetHispano.Agendas.Domain.Repositories;
using AltNetHispano.Agendas.Repositories.Memory;
using Moq;
using NUnit.Framework;

namespace AltNetHispano.Agendas.Tests
{
	public class TestBase
	{
		protected static IEventoRepository DefaultEventoRepository
		{
			get { return new EventoRepository(); }
		}

		protected static IPonenteRepository DefaultPonenteRepository
		{
			get { return new PonenteRepository(); }
		}

		[SetUp]
		public void LimpiarEventos()
		{
			EventoRepository.Clear();
		}

		[SetUp]
		public void LimpiarPonentes()
		{
			PonenteRepository.Clear();
		}

		[SetUp]
		public void SetearUsuario()
		{
			SetCurrentUser("neluz");
		}

		protected static void SetCurrentUser(string username)
		{
			var seguridad = new Mock<ISeguridad>();
			seguridad.Setup(s => s.GetUserName()).Returns(username);
			IdentityContext.Current = seguridad.Object;
		}
	}
}