comparison Agendas/trunk/src/Agendas.Tests/Blog/PublicadorTests.cs @ 105:1d820f17fc75

ajustes y correcciones en el publicador de blogs agregado de numeroOrden y urlWiki en metodo Publicar de Agenda y Evento (con test)
author jorge.rowies
date Mon, 06 Jun 2011 09:12:52 -0300
parents cc91817a4206
children
comparison
equal deleted inserted replaced
104:c5034884c7d7 105:1d820f17fc75
23 } 23 }
24 24
25 [Test] 25 [Test]
26 public void El_publicador_debe_disparar_los_writers_segun_la_accion_de_cada_track() 26 public void El_publicador_debe_disparar_los_writers_segun_la_accion_de_cada_track()
27 { 27 {
28 var eventoAgendar = Evento.Agendar(null, null, DateTime.MinValue, null); 28 //var eventoAgendar = Evento.Agendar(null, null, DateTime.MinValue, null);
29 var eventoPublicar = Evento.Agendar(null, null, DateTime.MinValue, null); 29 //var eventoPublicar = Evento.Agendar(null, null, DateTime.MinValue, null);
30
31 var trackAgendar = new Track(null, Accion.Agendar);
32 var trackPublicar = new Track(null, Accion.Publicar);
30 33
31 var agendarPostWriter = new Mock<IPostWriter>(); 34 var agendarPostWriter = new Mock<IPostWriter>();
32 agendarPostWriter.Setup(writer => writer.WritePost(eventoAgendar)); 35 agendarPostWriter.Setup(writer => writer.WritePost(trackAgendar));
33 36
34 var publicarPostWriter = new Mock<IPostWriter>(); 37 var publicarPostWriter = new Mock<IPostWriter>();
35 publicarPostWriter.Setup(writer => writer.WritePost(eventoPublicar)); 38 publicarPostWriter.Setup(writer => writer.WritePost(trackPublicar));
36 39
37 var factory = new Mock<IPostWriterFactory>(); 40 var factory = new Mock<IPostWriterFactory>();
38 factory.Setup(f => f.GetPostWriter(Accion.Agendar)).Returns(agendarPostWriter.Object); 41 factory.Setup(f => f.GetPostWriter(Accion.Agendar)).Returns(agendarPostWriter.Object);
39 factory.Setup(f => f.GetPostWriter(Accion.Publicar)).Returns(publicarPostWriter.Object); 42 factory.Setup(f => f.GetPostWriter(Accion.Publicar)).Returns(publicarPostWriter.Object);
40 43
41 var publicador = new BlogPublicador(factory.Object); 44 var publicador = new BlogPublicador(factory.Object);
42 publicador.Publicar(new List<Track> 45 publicador.Publicar(new List<Track>
43 { 46 {
44 new Track(eventoAgendar, Accion.Agendar), 47 trackAgendar,
45 new Track(eventoPublicar, Accion.Publicar) 48 trackPublicar
46 }); 49 });
47 50
48 factory.Verify(f => f.GetPostWriter(Accion.Agendar), Times.Once()); 51 factory.Verify(f => f.GetPostWriter(Accion.Agendar), Times.Once());
49 factory.Verify(f => f.GetPostWriter(Accion.Publicar), Times.Once()); 52 factory.Verify(f => f.GetPostWriter(Accion.Publicar), Times.Once());
50 53
51 agendarPostWriter.Verify(pw => pw.WritePost(eventoAgendar), Times.Once()); 54 agendarPostWriter.Verify(pw => pw.WritePost(trackAgendar), Times.Once());
52 publicarPostWriter.Verify(pw => pw.WritePost(eventoPublicar), Times.Once()); 55 publicarPostWriter.Verify(pw => pw.WritePost(trackPublicar), Times.Once());
53 } 56 }
54 } 57 }
55 } 58 }