view Agendas/trunk/src/Agendas.Configurations.Tests/Read_configuration.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
children
line wrap: on
line source

using AltNetHispano.Agendas.Configurations;
using NUnit.Framework;

namespace Agendas.Configurations.Tests
{
	[TestFixture]
	public class Read_configuration
	{
		[Test]
		public void Read()
		{
			var section = AgendasConfigurationManager.Publicadores;
			Assert.IsNotNull(section);
		}

		[Test]
		public void Read_twitter()
		{
			var publicadores = AgendasConfigurationManager.Publicadores;
			Assert.IsNotNull(publicadores);
			
			Assert.IsNotNull(publicadores.Twitter);

			var twitter = publicadores.Twitter;
			Assert.AreEqual(true, twitter.Enabled);
			
			Assert.IsNotNull(twitter.SignIn);
			Assert.AreEqual("consumerKey1", twitter.SignIn.ConsumerKey);
			Assert.AreEqual("consumerSecret1", twitter.SignIn.ConsumerSecret);

			Assert.AreEqual("consumerKey2", twitter.SendTwitter.ConsumerKey);
			Assert.AreEqual("consumerSecret2", twitter.SendTwitter.ConsumerSecret);
			Assert.AreEqual("accessToken2", twitter.SendTwitter.AccessToken);
			Assert.AreEqual("accessTokenSecret2", twitter.SendTwitter.AccessTokenSecret);
		}

		[Test]
		public void Read_blog()
		{
			var publicadores = AgendasConfigurationManager.Publicadores;
			Assert.IsNotNull(publicadores);

			Assert.IsNotNull(publicadores.Blog);

			var blog = publicadores.Blog;
			Assert.AreEqual(true, blog.Enabled);

			Assert.IsNotNull(blog.Writer);
			Assert.AreEqual("blogName", blog.Writer.BlogName);
			Assert.AreEqual("blogWriterMasterKey", blog.Writer.BlogWriterMasterKey);
			Assert.AreEqual("postWriterServiceUrl", blog.Writer.PostWriterServiceUrl);
		}

		[Test]
		public void Read_google()
		{
			var publicadores = AgendasConfigurationManager.Publicadores;
			Assert.IsNotNull(publicadores);

			Assert.IsNotNull(publicadores.Google);

			var google = publicadores.Google;
			Assert.AreEqual(true, google.Enabled);

			Assert.IsNotNull(google.Calendar);
			Assert.AreEqual("altnethispano.desa@gmail.com", google.Calendar.UserName);
			Assert.AreEqual("altnethispano.desa@gmail.com", google.Calendar.CalendarId);
			Assert.AreEqual("password", google.Calendar.Password);
		}
	}
}