diff Agendas/trunk/src/Agendas.Twitter.Tests/Publicador_tests.cs @ 158:734d3f0853bf

Manejando configuración de los publicadores con una sección propia en los .config Agregando la opción de habilitar / deshabilitar un publicador
author nelopauselli
date Fri, 05 Aug 2011 16:55:18 -0300
parents e6e6bfb1da9e
children 2d02adb79322
line wrap: on
line diff
--- a/Agendas/trunk/src/Agendas.Twitter.Tests/Publicador_tests.cs	Thu Aug 04 18:45:18 2011 -0300
+++ b/Agendas/trunk/src/Agendas.Twitter.Tests/Publicador_tests.cs	Fri Aug 05 16:55:18 2011 -0300
@@ -4,7 +4,6 @@
 using AltNetHispano.Agendas.Twitter;
 using Moq;
 using NUnit.Framework;
-using Twitterizer;
 
 namespace Agendas.Twitter.Tests
 {
@@ -15,17 +14,10 @@
 		public void Proponer_evento()
 		{
 			var adapter = new Mock<ITwitterAdapter>();
+
+			string message;
 			string twitt = null;
-
-			var response = new TwitterResponse<TwitterStatus>
-			               	{
-			               		Result =
-			               			RequestResult.Success
-			               	};
-
-			adapter.Setup(a => a.UpdateStatus(It.IsAny<OAuthTokens>(), It.IsAny<string>()))
-				.Returns(response)
-				.Callback<OAuthTokens, string>((tokens, status) => twitt = status);
+			adapter.Setup(a => a.Update(It.IsAny<string>(), out message)).Returns(true).Callback<string, string>((status, m) => twitt = status);
 
 			var publicador = new TwitterPublicador(adapter.Object);
 
@@ -33,7 +25,7 @@
 
 			agenda.Proponer("Identity Providers", null, null, TipoEvento.GrupoEstudio);
 
-			adapter.Verify(a => a.UpdateStatus(It.IsAny<OAuthTokens>(), It.IsAny<string>()), Times.Once());
+			adapter.Verify(a => a.Update(It.IsAny<string>(), out message), Times.Once());
 
 			Assert.That(twitt, Is.StringContaining("GrupoEstudio"));
 		}
@@ -42,28 +34,21 @@
 		public void Proponer_y_agendar_evento()
 		{
 			var adapter = new Mock<ITwitterAdapter>();
+
+			string message;
 			string twitt = null;
-
-			var response = new TwitterResponse<TwitterStatus>
-			{
-				Result =
-					RequestResult.Success
-			};
-
-			adapter.Setup(a => a.UpdateStatus(It.IsAny<OAuthTokens>(), It.IsAny<string>()))
-				.Returns(response)
-				.Callback<OAuthTokens, string>((tokens, status) => twitt = status);
+			adapter.Setup(a => a.Update(It.IsAny<string>(), out message)).Returns(true).Callback<string, string>((status, m) => twitt = status);
 
 			var publicador = new TwitterPublicador(adapter.Object);
 
 			var agenda = new Agenda(publicador, DefaultEventoRepository, DefaultPersonaRepository, DefaultPatrocinadorRepository);
 			agenda.Proponer("Identity Providers", null, null, TipoEvento.GrupoEstudio);
 
-			adapter.Verify(a => a.UpdateStatus(It.IsAny<OAuthTokens>(), It.IsAny<string>()), Times.Once());
+			adapter.Verify(a => a.Update(It.IsAny<string>(), out message), Times.Once());
 
 			agenda.Agendar("Identity Providers", TestsHelper.GetOrCreatePonente("Nelo Pauselli"), DateTime.Today.AddDays(7), null, TipoEvento.GrupoEstudio);
 
-			adapter.Verify(a => a.UpdateStatus(It.IsAny<OAuthTokens>(), It.IsAny<string>()), Times.Exactly(2));
+			adapter.Verify(a => a.Update(It.IsAny<string>(), out message), Times.Exactly(2));
 
 			Assert.That(twitt, Is.StringContaining("@nelopauselli"));