view Agendas/trunk/src/Agendas.Twitter.Tests/Publicador_tests.cs @ 167:ea85bd893247

Ajustes menores de UI
author nelopauselli
date Sat, 06 Aug 2011 02:51:07 -0300
parents 734d3f0853bf
children 2d02adb79322
line wrap: on
line source

using System;
using AltNetHispano.Agendas.Domain;
using AltNetHispano.Agendas.Tests;
using AltNetHispano.Agendas.Twitter;
using Moq;
using NUnit.Framework;

namespace Agendas.Twitter.Tests
{
	[TestFixture]
	public class Publicador_tests : TestBase
	{
		[Test]
		public void Proponer_evento()
		{
			var adapter = new Mock<ITwitterAdapter>();

			string message;
			string twitt = null;
			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.Update(It.IsAny<string>(), out message), Times.Once());

			Assert.That(twitt, Is.StringContaining("GrupoEstudio"));
		}

		[Test]
		public void Proponer_y_agendar_evento()
		{
			var adapter = new Mock<ITwitterAdapter>();

			string message;
			string twitt = null;
			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.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.Update(It.IsAny<string>(), out message), Times.Exactly(2));

			Assert.That(twitt, Is.StringContaining("@nelopauselli"));

		}
	}
}