view Agendas/trunk/src/Agendas.Tests/TestBase.cs @ 68:99a7df8e35bd

Merge
author nelopauselli
date Thu, 19 May 2011 01:29:52 -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;
		}
	}
}