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

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

using System;
using System.Linq;
using AltNetHispano.Agendas.Domain;
using NUnit.Framework;

namespace AltNetHispano.Agendas.Tests
{
	[TestFixture]
	public class TrackTests : TestBase
	{
		[Test]
		public void Track_al_publicar_y_modificar_evento()
		{
			var repository = DefaultEventoRepository;

			var agenda = new Agenda(null, null, repository, DefaultPonenteRepository);

			var fecha = DateTime.Now.AddDays(5);
			agenda.Publicar("Html 5", "jjmontes", fecha);
			var evento = repository.GetEventosConFecha().First();

			Assert.AreEqual(1, evento.Tracks.Count());
			Assert.AreEqual(Accion.Publicar, evento.Tracks.Last().Accion);

			agenda.ModificarEvento(evento.Id, "Html 5", "otro ponente", fecha);
			Assert.AreEqual(2, evento.Tracks.Count());
			Assert.AreEqual(Accion.Modificar, evento.Tracks.Last().Accion);

			agenda.ModificarEvento(evento.Id, "Html 5 y Css 3", "otro ponente", fecha);
			Assert.AreEqual(3, evento.Tracks.Count());
			Assert.AreEqual(Accion.CambiarTitulo, evento.Tracks.Last().Accion);
		}

		[Test]
		public void Track_al_publicar_y_realizar_evento()
		{
			var repository = DefaultEventoRepository;

			var agenda = new Agenda(null, null, repository, DefaultPonenteRepository);

			agenda.Publicar("Html 5", "jjmontes", DateTime.Now);
			var evento = repository.GetEventosConFecha().First();

			Assert.AreEqual(1, evento.Tracks.Count());
			Assert.AreEqual(Accion.Publicar, evento.Tracks.Last().Accion);

			agenda.RealizarEvento(evento.Id, "Esta es la sintesis");
			Assert.AreEqual(2, evento.Tracks.Count());
			Assert.AreEqual(Accion.Realizar, evento.Tracks.Last().Accion);
		}
	}
}