comparison 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
comparison
equal deleted inserted replaced
98:4895116b8232 99:3027c64344bd
1 using System;
2 using System.Collections.Generic;
3 using System.Configuration;
4 using System.Linq;
5 using System.ServiceModel;
6 using System.Text;
7 using Agendas.Blog;
8 using Agendas.Blog.Exceptions;
9 using Agendas.Blog.Impl;
10 using AltNetHispano.Agendas.Domain;
11 using Moq;
12 using NUnit.Framework;
13
14 namespace AltNetHispano.Agendas.Tests.Blog
15 {
16 [TestFixture]
17 public class PostWriterWebServiceAdapterTests
18 {
19 [SetUp]
20 public void ClearAppSettings()
21 {
22 ConfigurationManager.AppSettings["PublicadorBlog.PostWriterServiceUrl"] = "";
23 ConfigurationManager.AppSettings["PublicadorBlog.BlogName"] = "";
24 ConfigurationManager.AppSettings["PublicadorBlog.BlogWriterMasterKey"] = "";
25 }
26
27 [Test]
28 [ExpectedException(typeof(EndpointNotFoundException))]
29 public void Si_la_url_es_invalida_debe_lanzar_excepcion()
30 {
31 ConfigurationManager.AppSettings["PublicadorBlog.PostWriterServiceUrl"] = "http://dummy/dummy.aspx";
32 ConfigurationManager.AppSettings["PublicadorBlog.BlogName"] = "dummy";
33 ConfigurationManager.AppSettings["PublicadorBlog.BlogWriterMasterKey"] = "dummy";
34
35 var srv = new PostWriterWebServiceAdapter();
36 srv.WriteBlogPost(null, null, null, false);
37 }
38
39 [Test]
40 [ExpectedException(typeof(PostWriterServiceUrlNotFoundException))]
41 public void Si_la_url_no_esta_configurada_debe_lanzar_excepcion()
42 {
43 var srv = new PostWriterWebServiceAdapter();
44 srv.WriteBlogPost(null, null, null, false);
45 }
46
47 [Test]
48 [ExpectedException(typeof(BlogNameNotFoundException))]
49 public void Si_el_nombre_del_blog_no_esta_configurado_debe_lanzar_excepcion()
50 {
51 ConfigurationManager.AppSettings["PublicadorBlog.PostWriterServiceUrl"] = "http://dummy/dummy.aspx";
52 ConfigurationManager.AppSettings["PublicadorBlog.BlogWriterMasterKey"] = "dummy";
53
54 var srv = new PostWriterWebServiceAdapter();
55 srv.WriteBlogPost(null, null, null, false);
56 }
57
58 [Test]
59 [ExpectedException(typeof(BlogWriterMasterKeyNotFoundException))]
60 public void Si_la_master_key_no_esta_configurada_debe_lanzar_excepcion()
61 {
62 ConfigurationManager.AppSettings["PublicadorBlog.PostWriterServiceUrl"] = "http://dummy/dummy.aspx";
63
64 var srv = new PostWriterWebServiceAdapter();
65 srv.WriteBlogPost(null, null, null, false);
66 }
67 }
68
69 }