Mercurial > altnet-hispano
comparison Agendas/trunk/src/Agendas.Blog/Impl/PostWriter.cs @ 99:3027c64344bd
agregado de llamadas a web service para crear posts en el blog de la comunidad
agregado de tests sobre el publicador de blogs
agregado de tests sobre el adapter del web service
author | jorge.rowies |
---|---|
date | Sat, 04 Jun 2011 22:33:05 -0300 |
parents | bc46e7426c80 |
children | cc91817a4206 |
comparison
equal
deleted
inserted
replaced
98:4895116b8232 | 99:3027c64344bd |
---|---|
1 using System; | 1 using System.Linq; |
2 using System.Linq; | |
3 using AltNetHispano.Agendas.Domain; | 2 using AltNetHispano.Agendas.Domain; |
4 | 3 |
5 namespace Agendas.Blog.Impl | 4 namespace Agendas.Blog.Impl |
6 { | 5 { |
7 public abstract class PostWriter : IPostWriter | 6 public abstract class PostWriter : IPostWriter |
8 { | 7 { |
8 private readonly IPostWriterWebService _postWriterWebService; | |
9 | |
10 protected PostWriter(IPostWriterWebService postWriterWebService) | |
11 { | |
12 _postWriterWebService = postWriterWebService; | |
13 } | |
14 | |
9 public virtual void WritePost(Evento evento) | 15 public virtual void WritePost(Evento evento) |
10 { | 16 { |
11 var title = GetTitle(evento); | 17 var title = GetTitle(evento); |
12 var body = GetBody(evento); | 18 var body = GetBody(evento); |
13 this.ExecuteService(title, body); | 19 this.ExecuteService(title, body, this.GetNombreUsuario(evento)); |
14 } | 20 } |
15 | 21 |
16 protected abstract string GetBody(Evento evento); | 22 protected abstract string GetBody(Evento evento); |
17 | 23 |
18 protected abstract string GetTitle(Evento evento); | 24 protected abstract string GetTitle(Evento evento); |
20 protected string GetNombreUsuario(Evento evento) | 26 protected string GetNombreUsuario(Evento evento) |
21 { | 27 { |
22 return evento.Tracks.Single(t => t.Accion == Accion.Publicar).Usuario; | 28 return evento.Tracks.Single(t => t.Accion == Accion.Publicar).Usuario; |
23 } | 29 } |
24 | 30 |
25 protected void ExecuteService(string title, string body) | 31 protected void ExecuteService(string title, string body, string author) |
26 { | 32 { |
27 //TODO: invocar al web service | 33 _postWriterWebService.WriteBlogPost(title, body, author, true); |
28 throw new NotImplementedException(); | |
29 } | 34 } |
35 | |
36 | |
30 } | 37 } |
31 } | 38 } |