view Agendas/trunk/src/Agendas.Tests/TestBase.cs @ 54:3059a5f8930f

Code cleanup
author nelopauselli
date Sat, 14 May 2011 13:01:24 -0300
parents 3ebe89c88caa
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;
		}
	}
}