changeset 186:71737419a839

Ticket 143: Test de unidad, y algo de configuración para acortar URL con servicio de Google.
author juanjose.montesdeocaarbos
date Tue, 09 Aug 2011 08:43:25 -0300
parents 3c70b0d8bd69
children 37bc622980b4
files Agendas/trunk/src/Agendas.Google.Test/Agendas.Google.Test.csproj Agendas/trunk/src/Agendas.Google.Test/App.config Agendas/trunk/src/Agendas.Google.Test/GUrlShortenerTest.cs Agendas/trunk/src/Agendas.Google/GUrlShortener.cs
diffstat 4 files changed, 67 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/Agendas/trunk/src/Agendas.Google.Test/Agendas.Google.Test.csproj	Mon Aug 08 06:17:19 2011 -0300
+++ b/Agendas/trunk/src/Agendas.Google.Test/Agendas.Google.Test.csproj	Tue Aug 09 08:43:25 2011 -0300
@@ -57,6 +57,7 @@
   </ItemGroup>
   <ItemGroup>
     <Compile Include="GCalendarTest.cs" />
+    <Compile Include="GUrlShortenerTest.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
     <Compile Include="PublicadorTest.cs" />
   </ItemGroup>
--- a/Agendas/trunk/src/Agendas.Google.Test/App.config	Mon Aug 08 06:17:19 2011 -0300
+++ b/Agendas/trunk/src/Agendas.Google.Test/App.config	Tue Aug 09 08:43:25 2011 -0300
@@ -10,4 +10,32 @@
 			<calendar userName="altnethispano.desa@gmail.com" password="fA&amp;Ec3wU3est" calendarId="altnethispano.desa@gmail.com" />
 		</google>
 	</publicadores>
+
+  <system.serviceModel>
+	<client>
+	  <endpoint address="https://www.googleapis.com/urlshortener/v1"
+     binding="webHttpBinding"
+     bindingConfiguration="webBinding"
+     behaviorConfiguration="urlShortener"
+     contract="GoogleAPI.UrlShortener.IUrlShortenerService"
+     name="UrlShortenerREST" />
+	</client>
+
+	<bindings>
+	  <webHttpBinding>
+		<binding name="webBinding">
+		  <security mode="Transport"></security>
+		</binding>
+	  </webHttpBinding>
+	</bindings>
+
+	<behaviors>
+	  <endpointBehaviors>
+		<behavior name="urlShortener">
+		  <webHttp />
+		</behavior>
+	  </endpointBehaviors>
+	</behaviors>
+
+  </system.serviceModel>
 </configuration>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Agendas/trunk/src/Agendas.Google.Test/GUrlShortenerTest.cs	Tue Aug 09 08:43:25 2011 -0300
@@ -0,0 +1,20 @@
+using AltNetHispano.Agendas.Google;
+using NUnit.Framework;
+
+namespace Agendas.Google.Test
+{
+	[TestFixture]
+	[Explicit]
+	public class GUrlShortenerTest
+	{
+		[Test]
+		public void Obtener_Url_corta()
+		{
+			var gUrlShortener = new GUrlShortener();
+
+			var shortUrl = gUrlShortener.GetShortUrl("http://www.twitter.com");
+
+			Assert.AreEqual("http://goo.gl/CbHS", shortUrl);
+		}
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Agendas/trunk/src/Agendas.Google/GUrlShortener.cs	Tue Aug 09 08:43:25 2011 -0300
@@ -0,0 +1,18 @@
+using System;
+//using GoogleAPI.UrlShortener;
+
+namespace AltNetHispano.Agendas.Google
+{
+	public class GUrlShortener
+	{
+		public string GetShortUrl(string url)
+		{
+			//TODO: Esto es utilizando la GoogleAPI.UrlShortener.
+			//var client = new UrlResource();
+			//var response = client.Insert(new ShortenRequest { LongUrl = url });
+
+			//return response.Id;
+			throw new NotImplementedException();
+		}
+	}
+}
\ No newline at end of file