Mercurial > altnet-hispano
comparison Agendas/trunk/src/Agendas.Twitter.Tests/Publicador_tests.cs @ 228:9f61e8555114
Nombrando a todos los ponentes en los twitter y partiendo los mensajes que superan el máximo permitido
author | nelopauselli |
---|---|
date | Wed, 28 Sep 2011 18:51:53 -0300 |
parents | 5346c0500594 |
children | 33976aea7546 |
comparison
equal
deleted
inserted
replaced
227:11545cc95491 | 228:9f61e8555114 |
---|---|
1 using System; | 1 using System; |
2 using System.Collections.Generic; | |
3 using System.Linq; | |
2 using AltNetHispano.Agendas.Domain; | 4 using AltNetHispano.Agendas.Domain; |
3 using AltNetHispano.Agendas.Tests; | 5 using AltNetHispano.Agendas.Tests; |
4 using AltNetHispano.Agendas.Twitter; | 6 using AltNetHispano.Agendas.Twitter; |
5 using Moq; | 7 using Moq; |
6 using NUnit.Framework; | 8 using NUnit.Framework; |
54 adapter.Verify(a => a.Update(It.IsAny<string>(), out message), Times.Exactly(2)); | 56 adapter.Verify(a => a.Update(It.IsAny<string>(), out message), Times.Exactly(2)); |
55 | 57 |
56 Assert.That(twitt, Is.StringContaining("@nelopauselli")); | 58 Assert.That(twitt, Is.StringContaining("@nelopauselli")); |
57 | 59 |
58 } | 60 } |
61 | |
62 [Test] | |
63 public void Twitter_texto_largo() | |
64 { | |
65 var adapter = new Mock<ITwitterAdapter>(); | |
66 | |
67 string message; | |
68 var twitters= new List<string>(); | |
69 adapter.Setup(a => a.Update(It.IsAny<string>(), out message)).Returns(true).Callback<string, string>((status, m) => twitters.Add(status)); | |
70 | |
71 var publicador = new TwitterPublicador(adapter.Object); | |
72 var agenda = new Agenda(publicador, DefaultEventoRepository, DefaultPersonaRepository); | |
73 | |
74 var ponente = new Persona("Carlos Peix", "carlospeix@gmail.com", "carlospeix", "http://www.carlospeix.com.ar"); | |
75 DefaultPersonaRepository.Save(ponente); | |
76 | |
77 var otrosPonentes = new Persona("Nelo Pauselli", "nelopauselli@gmail.com", "nelopauselli", | |
78 "http://nelopauselli.blogspot.com/"); | |
79 DefaultPersonaRepository.Save(otrosPonentes); | |
80 | |
81 var inicio = DateTime.Now.AddDays(3); | |
82 | |
83 agenda.Agendar("Identity Providers Públicos y Empresariales", ponente.Id, inicio, inicio.AddHours(2), null, TipoEvento.Van, | |
84 new[] {otrosPonentes.Id}); | |
85 | |
86 Assert.IsTrue(twitters.Any()); | |
87 var joined = string.Empty; | |
88 foreach (var twitter in twitters) | |
89 { | |
90 Console.WriteLine(twitter); | |
91 Assert.LessOrEqual(twitter.Length, 140); | |
92 joined += twitter; | |
93 } | |
94 Assert.That(joined, Is.StringContaining("Identity Providers Públicos y Empresariales")); | |
95 Assert.That(joined, Is.StringContaining("@carlospeix")); | |
96 Assert.That(joined, Is.StringContaining("@nelopauselli")); | |
97 | |
98 Assert.AreEqual(2, twitters.Count()); | |
99 Assert.AreEqual("Se ha agendando el evento Identity Providers Públicos y Empresariales con @carlospeix, @nelopauselli para el 01/10/2011...", twitters.First()); | |
100 Assert.AreEqual("...por http://snipr.com/virtualaltnet", twitters.Last()); | |
101 | |
102 adapter.Verify(a => a.Update(It.IsAny<string>(), out message), Times.Exactly(2)); | |
103 | |
104 } | |
59 } | 105 } |
60 } | 106 } |