Mercurial > altnet-hispano
view Agendas/trunk/src/Agendas.Tests/Blog/PostWriterWebServiceAdapterTests.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 | |
children | 1d820f17fc75 |
line wrap: on
line source
using System; using System.Collections.Generic; using System.Configuration; using System.Linq; using System.ServiceModel; using System.Text; using Agendas.Blog; using Agendas.Blog.Exceptions; using Agendas.Blog.Impl; using AltNetHispano.Agendas.Domain; using Moq; using NUnit.Framework; namespace AltNetHispano.Agendas.Tests.Blog { [TestFixture] public class PostWriterWebServiceAdapterTests { [SetUp] public void ClearAppSettings() { ConfigurationManager.AppSettings["PublicadorBlog.PostWriterServiceUrl"] = ""; ConfigurationManager.AppSettings["PublicadorBlog.BlogName"] = ""; ConfigurationManager.AppSettings["PublicadorBlog.BlogWriterMasterKey"] = ""; } [Test] [ExpectedException(typeof(EndpointNotFoundException))] public void Si_la_url_es_invalida_debe_lanzar_excepcion() { ConfigurationManager.AppSettings["PublicadorBlog.PostWriterServiceUrl"] = "http://dummy/dummy.aspx"; ConfigurationManager.AppSettings["PublicadorBlog.BlogName"] = "dummy"; ConfigurationManager.AppSettings["PublicadorBlog.BlogWriterMasterKey"] = "dummy"; var srv = new PostWriterWebServiceAdapter(); srv.WriteBlogPost(null, null, null, false); } [Test] [ExpectedException(typeof(PostWriterServiceUrlNotFoundException))] public void Si_la_url_no_esta_configurada_debe_lanzar_excepcion() { var srv = new PostWriterWebServiceAdapter(); srv.WriteBlogPost(null, null, null, false); } [Test] [ExpectedException(typeof(BlogNameNotFoundException))] public void Si_el_nombre_del_blog_no_esta_configurado_debe_lanzar_excepcion() { ConfigurationManager.AppSettings["PublicadorBlog.PostWriterServiceUrl"] = "http://dummy/dummy.aspx"; ConfigurationManager.AppSettings["PublicadorBlog.BlogWriterMasterKey"] = "dummy"; var srv = new PostWriterWebServiceAdapter(); srv.WriteBlogPost(null, null, null, false); } [Test] [ExpectedException(typeof(BlogWriterMasterKeyNotFoundException))] public void Si_la_master_key_no_esta_configurada_debe_lanzar_excepcion() { ConfigurationManager.AppSettings["PublicadorBlog.PostWriterServiceUrl"] = "http://dummy/dummy.aspx"; var srv = new PostWriterWebServiceAdapter(); srv.WriteBlogPost(null, null, null, false); } } }