# HG changeset patch # User juanjose.montesdeocaarbos # Date 1321010061 10800 # Node ID e2c6610b14c7f61c17646bdff11495a94a0eb571 # Parent 3bb779434ae8416828688993be791b55b2670555 Ticket #194: Error enviar twit cuando Cancela Evento. Test y Corrección. diff -r 3bb779434ae8 -r e2c6610b14c7 Agendas/trunk/src/Agendas.Twitter.Tests/Publicador_tests.cs --- 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(), 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 diff -r 3bb779434ae8 -r e2c6610b14c7 Agendas/trunk/src/Agendas.Twitter/TwitterPublicador.cs --- 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();