view Agendas/trunk/src/Agendas.Tests/TrackTests.cs @ 98:4895116b8232

subida del web service para escribir posts en el blog del portal
author jorge.rowies
date Sat, 04 Jun 2011 14:10:21 -0300
parents 26d0513a8410
children db4b1e2cae49
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
	{
		private const string urlInvitacion = "http://groups.google.com/group/altnet-hispano/browse_thread/thread/65d6d26eb381386e";

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

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

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

			Assert.AreEqual(1, evento.Tracks.Count());
			var ultimo = evento.Tracks.Last();
			Assert.AreEqual(evento, ultimo.Evento);
			Assert.AreEqual(Accion.Agendar, ultimo.Accion);

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

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

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

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

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

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

			//TODO: confirmar evento y evaluar .tracks
		}
	}
}