diff Agendas/trunk/src/Agendas.Google.Test/GCalendarTest.cs @ 130:0ea32a748453

Se termina el publicador via el calendario de google, además se realizan las pruebas unitarias.
author alabra
date Sun, 10 Jul 2011 18:50:11 -0400
parents
children 734d3f0853bf
line wrap: on
line diff
--- /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