changeset 271:e2c6610b14c7

Ticket #194: Error enviar twit cuando Cancela Evento. Test y Corrección.
author juanjose.montesdeocaarbos
date Fri, 11 Nov 2011 08:14:21 -0300
parents 3bb779434ae8
children 33e6ee3d1776
files Agendas/trunk/src/Agendas.Twitter.Tests/Publicador_tests.cs Agendas/trunk/src/Agendas.Twitter/TwitterPublicador.cs
diffstat 2 files changed, 24 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/Agendas/trunk/src/Agendas.Twitter.Tests/Publicador_tests.cs	Wed Oct 26 09:31:17 2011 -0300
+++ b/Agendas/trunk/src/Agendas.Twitter.Tests/Publicador_tests.cs	Fri Nov 11 08:14:21 2011 -0300
@@ -134,5 +134,27 @@
 			adapter.Verify(a => a.Update(It.IsAny<string>(), out message), Times.Once());
 
 		}
-	}
+
+        [Test]
+        public void Cancelar_evento()
+        {
+            var title = string.Format("Titulo: {0}{1}{2}{3}{4}{5}{6}", DateTime.Now.Year, DateTime.Now.Month, 
+                DateTime.Now.Day, DateTime.Now.Hour, DateTime.Now.Minute, DateTime.Now.Second, DateTime.Now.Millisecond);
+            string twitt = null;
+
+            var publicador = new TwitterPublicador();
+            var agenda = new Agenda(publicador, DefaultEventoRepository, DefaultPersonaRepository);
+            var resultAgendar = agenda.Agendar(title, null, DateTime.Today.AddDays(8), DateTime.Today.AddDays(8).AddHours(2), string.Empty, TipoEvento.GrupoEstudio);
+            Assert.IsTrue(resultAgendar.Succeful);
+
+            var evento = agenda.GetEventosActivos().Where(e => e.Titulo == title).FirstOrDefault();
+
+            agenda = new Agenda(publicador, DefaultEventoRepository, DefaultPersonaRepository);
+            var resultCancelar = agenda.Cancelar(evento.Id);
+
+            Assert.IsTrue(resultCancelar.Succeful);
+            Assert.AreEqual(0, resultCancelar.Warnings.Count());
+        }
+
+    }
 }
\ No newline at end of file
--- a/Agendas/trunk/src/Agendas.Twitter/TwitterPublicador.cs	Wed Oct 26 09:31:17 2011 -0300
+++ b/Agendas/trunk/src/Agendas.Twitter/TwitterPublicador.cs	Fri Nov 11 08:14:21 2011 -0300
@@ -69,7 +69,7 @@
 		{
 			ITwitterWriter writer;
 			if (!_writers.TryGetValue(track.Accion, out writer))
-				return new[] {string.Empty};
+				return new string[0];
 
 			var partes = writer.Write(track).Where(t => !string.IsNullOrWhiteSpace(t)).ToArray();