view Agendas/trunk/src/Agendas.Google.Test/GUrlShortenerTest.cs @ 215:85ddae313408

Se soluciona ticket #178. Se resuelve ordenar Historico de Eventos solamente por NumeroOrden de forma descendente.
author alabra
date Sun, 04 Sep 2011 18:35:33 -0300
parents 03c237cd5cc4
children 806fd94727ce
line wrap: on
line source

using System;
using System.Net;
using AltNetHispano.Agendas.Google;
using NUnit.Framework;

namespace Agendas.Google.Test
{
	[TestFixture]
	public class GUrlShortenerTest
	{
		[Test]
		public void Obtener_url_corta()
		{
			var gUrlShortener = new GUrlShortenerAdapter();

			var shortUrl = gUrlShortener.GetShortUrl("http://www.twitter.com");

			Console.WriteLine(shortUrl);

			Assert.AreEqual("http://goo.gl/CbHS", shortUrl);
		}

		[Test]
		public void Acceder_a_url_corta()
		{
			var gUrlShortener = new GUrlShortenerAdapter();

			var shortUrl = gUrlShortener.GetShortUrl("http://altnethispano.org");

			Console.WriteLine(shortUrl);

			var request = WebRequest.Create(shortUrl);
			var response = request.GetResponse() as HttpWebResponse;

			Assert.IsNotNull(response);
			Assert.AreEqual(HttpStatusCode.OK, response.StatusCode);

			Assert.AreEqual(new Uri("http://altnethispano.org/Inicio.aspx"), response.ResponseUri);

		}
	}
}