# HG changeset patch # User alabra # Date 1310338211 14400 # Node ID 0ea32a74845363e93b3608cbfc17ee6cd6a2c814 # Parent a6d20ea228a5a8f4904644823de6049d518ebe7d Se termina el publicador via el calendario de google, además se realizan las pruebas unitarias. diff -r a6d20ea228a5 -r 0ea32a748453 Agendas/trunk/src/Agendas.Google.Test/Agendas.Google.Test.csproj --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Agendas/trunk/src/Agendas.Google.Test/Agendas.Google.Test.csproj Sun Jul 10 18:50:11 2011 -0400 @@ -0,0 +1,89 @@ + + + + Debug + AnyCPU + 8.0.30703 + 2.0 + {3257EEC5-8FB7-4AD6-AD4C-F9748A1791B1} + Library + Properties + Agendas.Google.Test + Agendas.Google.Test + v4.0 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + ..\packages\Moq.4.0.10827\lib\NET40\Moq.dll + + + False + ..\packages\NUnit.2.5.10.11092\lib\nunit.framework.dll + + + False + ..\packages\NUnit.2.5.10.11092\lib\nunit.mocks.dll + + + False + ..\packages\NUnit.2.5.10.11092\lib\pnunit.framework.dll + + + + + + + + + + + + + + + + + + + + + + {A14907DF-02E4-4FA7-BE27-4292AF50AA22} + Agendas.Domain + + + {45804F1F-EB72-4F82-A227-088CAD9B785D} + Agendas.Google + + + {29AC1253-D455-4958-9AAA-DA879C3889A4} + Agendas.Tests + + + + + \ No newline at end of file diff -r a6d20ea228a5 -r 0ea32a748453 Agendas/trunk/src/Agendas.Google.Test/App.config --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Agendas/trunk/src/Agendas.Google.Test/App.config Sun Jul 10 18:50:11 2011 -0400 @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff -r a6d20ea228a5 -r 0ea32a748453 Agendas/trunk/src/Agendas.Google.Test/GCalendarTest.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Agendas/trunk/src/Agendas.Google.Test/GCalendarTest.cs Sun Jul 10 18:50:11 2011 -0400 @@ -0,0 +1,49 @@ +using System; +using System.Configuration; +using AltNetHispano.Agendas.Domain; +using AltNetHispano.Agendas.Google; +using AltNetHispano.Agendas.Google.DetailsEvents; +using AltNetHispano.Agendas.Tests; +using Moq; +using NUnit.Framework; + +namespace Agendas.Google.Test +{ + [TestFixture] + public class GCalendarTest : TestBase + { + private readonly DateTime _fechaEvento = new DateTime(2011, 07, 16); + + [Test] + public void CrearEventoGoogleCalendar() + { + var gCalendar = new GCalendarAdapter("VAN", ConfigurationManager.AppSettings["userNameGoogleCalendar"], + ConfigurationManager.AppSettings["passwordGoogleCalendar"], + ConfigurationManager.AppSettings["calendarIdGoogleCalendar"]); + var ev = Evento.Agendar("Evento Test", null, _fechaEvento, "url", TipoEvento.Cafe); + string message; + var detail = new CafeGEventDetail(); + detail.Generate(ev); + var result = gCalendar.CreateEvent(detail, out message); + + Assert.AreEqual(true, result); + Assert.AreEqual(message, "Event create successful"); + } + [Test] + public void EliminarEventoGoogleCalendar() + { + var gCalendar = new GCalendarAdapter("VAN", ConfigurationManager.AppSettings["userNameGoogleCalendar"], + ConfigurationManager.AppSettings["passwordGoogleCalendar"], + ConfigurationManager.AppSettings["calendarIdGoogleCalendar"]); + string message; + var startEvent = new DateTime(_fechaEvento.Year, _fechaEvento.Month, _fechaEvento.Day, 18, 0, 0, + DateTimeKind.Utc); + var endEvent = new DateTime(_fechaEvento.Year, _fechaEvento.Month, _fechaEvento.Day, 20, 0, 0, + DateTimeKind.Utc); + var result = gCalendar.DeleteEvent(startEvent, endEvent, out message); + + Assert.AreEqual(true, result); + Assert.AreEqual(message, "Event delete successful"); + } + } +} \ No newline at end of file diff -r a6d20ea228a5 -r 0ea32a748453 Agendas/trunk/src/Agendas.Google.Test/Properties/AssemblyInfo.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Agendas/trunk/src/Agendas.Google.Test/Properties/AssemblyInfo.cs Sun Jul 10 18:50:11 2011 -0400 @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Agendas.Google.Test")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Microsoft")] +[assembly: AssemblyProduct("Agendas.Google.Test")] +[assembly: AssemblyCopyright("Copyright © Microsoft 2011")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("9994c0cd-3860-491f-8ad3-a638e7b7cafa")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff -r a6d20ea228a5 -r 0ea32a748453 Agendas/trunk/src/Agendas.Google.Test/PublicadorTest.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Agendas/trunk/src/Agendas.Google.Test/PublicadorTest.cs Sun Jul 10 18:50:11 2011 -0400 @@ -0,0 +1,139 @@ +using System; +using AltNetHispano.Agendas.Domain; +using AltNetHispano.Agendas.Google; +using AltNetHispano.Agendas.Google.DetailsEvents; +using AltNetHispano.Agendas.Tests; +using Moq; +using NUnit.Framework; + +namespace Agendas.Google.Test +{ + [TestFixture] + public class PublicadorTest : TestBase + { + /// + /// Validar que solamente se creen eventos cuando la acción sea Accion.Agendar + /// + [Test] + public void CuandoPublicarEventoDadoAccionAgendarEntoncesEventoCreado() + { + + } + + /// + /// Validar que se halla creado IGEventDetail según detalles y tipo de evento (VAN, Café, Grupo estudio) + /// - Summary correcto, según tipo + /// - Summary con fecha en cultura es-ES + /// - Fecha de inicio y termino en Utc. + /// - Location + /// - Titulo según tipo + /// + [Test] + public void CuandoPublicarEventoDadoTipoVanEntoncesDetalleCorrecto() + { + var adapter = new Mock(); + var detail = new VanGEventDetail(); + + var publicador = new GooglePublicador(adapter.Object); + var agenda = new Agenda(publicador, DefaultEventoRepository, DefaultPersonaRepository); + agenda.Proponer("Agile Patterns", null, null, TipoEvento.Van); + agenda.Agendar("Agile Patterns", "Alejandro Labra", new DateTime(2011, 07, 09), "https://groups.google.com/d/topic/altnet-hispano/arYEMsPiAtY/discussion", TipoEvento.Van); + + var ev = DefaultEventoRepository.GetActivos()[0]; + detail.Generate(ev); + + Assert.AreEqual("http://snipr.com/virtualaltnet", detail.Location); + Assert.AreEqual("VAN sobre Agile Patterns", detail.Title); + + Assert.AreEqual(DateTimeKind.Utc, detail.StartEvent.Kind); + Assert.AreEqual(18, detail.StartEvent.Hour); + Assert.AreEqual(ev.Fecha.Value.Day, detail.StartEvent.Day); + Assert.AreEqual(ev.Fecha.Value.Month, detail.StartEvent.Month); + Assert.AreEqual(ev.Fecha.Value.Year, detail.StartEvent.Year); + + Assert.AreEqual(DateTimeKind.Utc, detail.EndEvent.Kind); + Assert.AreEqual(20, detail.EndEvent.Hour); + Assert.AreEqual(ev.Fecha.Value.Day, detail.EndEvent.Day); + Assert.AreEqual(ev.Fecha.Value.Month, detail.EndEvent.Month); + Assert.AreEqual(ev.Fecha.Value.Year, detail.EndEvent.Year); + + Assert.AreEqual("La comunidad ALT.NET Hispano (http://altnethispano.org) realizará una VAN sobre Agile Patterns, con Alejandro Labra." + + "\n\rFecha: sábado, 09 de julio de 2011 a las 18:00 hrs. Hora Internacional (GMT/UTC), con una duración aproximada de 2 horas." + + "\n\rPueden plantear sus comentarios e inquietudes sobre el tema de la reunión en: https://groups.google.com/d/topic/altnet-hispano/arYEMsPiAtY/discussion" + + "\n\rPara mayor información sobre cómo atender la reunión consulten: http://tinyurl.com/van-hispano" + + "\n\rPueden vincular el Google Calendar al suyo (http://screenr.com/nr7)", detail.Summary); + } + + [Test] + public void CuandoPublicarEventoTipoCafeEntoncesDetalleCorrecto() + { + var adapter = new Mock(); + var detail = new CafeGEventDetail(); + + var publicador = new GooglePublicador(adapter.Object); + var agenda = new Agenda(publicador, DefaultEventoRepository, DefaultPersonaRepository); + agenda.Proponer("Agile Patterns", null, null, TipoEvento.Cafe); + agenda.Agendar("Agile Patterns", null, new DateTime(2011, 07, 09), "https://groups.google.com/d/topic/altnet-hispano/arYEMsPiAtY/discussion", TipoEvento.Cafe); + + var ev = DefaultEventoRepository.GetActivos()[0]; + detail.Generate(ev); + + Assert.AreEqual("http://snipr.com/virtualaltnet", detail.Location); + Assert.AreEqual("Alt.Net Café Agile Patterns", detail.Title); + + Assert.AreEqual(DateTimeKind.Utc, detail.StartEvent.Kind); + Assert.AreEqual(18, detail.StartEvent.Hour); + Assert.AreEqual(ev.Fecha.Value.Day, detail.StartEvent.Day); + Assert.AreEqual(ev.Fecha.Value.Month, detail.StartEvent.Month); + Assert.AreEqual(ev.Fecha.Value.Year, detail.StartEvent.Year); + + Assert.AreEqual(DateTimeKind.Utc, detail.EndEvent.Kind); + Assert.AreEqual(20, detail.EndEvent.Hour); + Assert.AreEqual(ev.Fecha.Value.Day, detail.EndEvent.Day); + Assert.AreEqual(ev.Fecha.Value.Month, detail.EndEvent.Month); + Assert.AreEqual(ev.Fecha.Value.Year, detail.EndEvent.Year); + + Assert.AreEqual("La comunidad ALT.NET Hispano (http://altnethispano.org) realizará un Alt.Net Cafe virtual con el tema Agile Patterns." + + "\n\rFecha: sábado, 09 de julio de 2011 a las 18:00 hrs. Hora Internacional (GMT/UTC), con una duración aproximada de 2 horas." + + "\n\rPueden plantear sus comentarios e inquietudes sobre el tema de la reunión en: https://groups.google.com/d/topic/altnet-hispano/arYEMsPiAtY/discussion" + + "\n\rPara mayor información sobre cómo atender la reunión consulten: http://tinyurl.com/van-hispano" + + "\n\rPueden vincular el Google Calendar al suyo (http://screenr.com/nr7)", detail.Summary); + } + + [Test] + public void CuandoPublicarEventoTipoEstudioEntoncesDetalleCorrecto() + { + var adapter = new Mock(); + var detail = new EstudioGEventDetail(); + + var publicador = new GooglePublicador(adapter.Object); + var agenda = new Agenda(publicador, DefaultEventoRepository, DefaultPersonaRepository); + agenda.Proponer("Agile Patterns", null, null, TipoEvento.GrupoEstudio); + agenda.Agendar("Agile Patterns", null, new DateTime(2011, 07, 09), "https://groups.google.com/d/topic/altnet-hispano/arYEMsPiAtY/discussion", TipoEvento.GrupoEstudio); + + var ev = DefaultEventoRepository.GetActivos()[0]; + detail.Generate(ev); + + Assert.AreEqual("http://snipr.com/virtualaltnet", detail.Location); + Assert.AreEqual("Grupo de Estudio Agile Patterns", detail.Title); + + Assert.AreEqual(DateTimeKind.Utc, detail.StartEvent.Kind); + Assert.AreEqual(18, detail.StartEvent.Hour); + Assert.AreEqual(ev.Fecha.Value.Day, detail.StartEvent.Day); + Assert.AreEqual(ev.Fecha.Value.Month, detail.StartEvent.Month); + Assert.AreEqual(ev.Fecha.Value.Year, detail.StartEvent.Year); + + Assert.AreEqual(DateTimeKind.Utc, detail.EndEvent.Kind); + Assert.AreEqual(20, detail.EndEvent.Hour); + Assert.AreEqual(ev.Fecha.Value.Day, detail.EndEvent.Day); + Assert.AreEqual(ev.Fecha.Value.Month, detail.EndEvent.Month); + Assert.AreEqual(ev.Fecha.Value.Year, detail.EndEvent.Year); + + Assert.AreEqual("La comunidad ALT.NET Hispano (http://altnethispano.org) realizará un grupo de estudio sobre tema Agile Patterns." + + "\n\rFecha: sábado, 09 de julio de 2011 a las 18:00 hrs. Hora Internacional (GMT/UTC), con una duración aproximada de 2 horas." + + "\n\rPueden plantear sus comentarios e inquietudes sobre el tema de la reunión en: https://groups.google.com/d/topic/altnet-hispano/arYEMsPiAtY/discussion" + + "\n\rPara mayor información sobre cómo atender la reunión consulten: http://tinyurl.com/van-hispano" + + "\n\rPueden vincular el Google Calendar al suyo (http://screenr.com/nr7)", detail.Summary); + } + } +} \ No newline at end of file diff -r a6d20ea228a5 -r 0ea32a748453 Agendas/trunk/src/Agendas.Google.Test/packages.config --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Agendas/trunk/src/Agendas.Google.Test/packages.config Sun Jul 10 18:50:11 2011 -0400 @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff -r a6d20ea228a5 -r 0ea32a748453 Agendas/trunk/src/Agendas.Google/Agendas.Google.csproj --- a/Agendas/trunk/src/Agendas.Google/Agendas.Google.csproj Sun Jul 10 18:08:00 2011 -0400 +++ b/Agendas/trunk/src/Agendas.Google/Agendas.Google.csproj Sun Jul 10 18:50:11 2011 -0400 @@ -44,6 +44,7 @@ ..\packages\Google.GData.Extensions.1.8.0.0\lib\Google.GData.Extensions.dll + @@ -52,9 +53,13 @@ + + + + @@ -66,6 +71,7 @@ +