view Agendas/trunk/src/Agendas.Tests/TestBase.cs @ 66:a61f3204c9f7

Merge
author jorge.rowies
date Tue, 17 May 2011 18:25:17 -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;
		}
	}
}