diff Agendas/trunk/src/Agendas.Tests/TrackTests.cs @ 39:e548379cc314

track de cambios en evento
author nelo@MTEySS.neluz.int
date Fri, 18 Mar 2011 00:10:21 -0300
parents
children 3ebe89c88caa
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Agendas/trunk/src/Agendas.Tests/TrackTests.cs	Fri Mar 18 00:10:21 2011 -0300
@@ -0,0 +1,53 @@
+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, SeguridadServiceDefault, 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, SeguridadServiceDefault, 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);
+        }
+
+    }
+}
\ No newline at end of file