view Agendas/trunk/src/Agendas.Repositories.Tests/TestsHelper.cs @ 234:cc71f96ac134

Combinar
author juanjose.montesdeocaarbos
date Tue, 04 Oct 2011 20:36:27 -0300
parents 68b09c30b0d2
children c61954d24c8c
line wrap: on
line source

using System;
using AltNetHispano.Agendas.Domain;
using AltNetHispano.Agendas.Domain.Repositories;

namespace Agendas.Repositories.Tests
{
	public class TestsHelper
	{
		private readonly IPersonaRepository _repository;
		
		public TestsHelper(IPersonaRepository repository)
		{
			_repository = repository;
		}

		public Guid GetOrCreatePonente(string nombre)
		{
			var persona = _repository.GetByNombre(nombre);
			if (persona == null)
			{
				persona = new Persona(nombre) { Twitter = nombre.Replace(" ", string.Empty).ToLower() };
				_repository.Save(persona);
			}
			return persona.Id;
		}

	}
}