comparison 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
comparison
equal deleted inserted replaced
129:a6d20ea228a5 130:0ea32a748453
1 using System;
2 using System.Configuration;
3 using AltNetHispano.Agendas.Domain;
4 using AltNetHispano.Agendas.Google;
5 using AltNetHispano.Agendas.Google.DetailsEvents;
6 using AltNetHispano.Agendas.Tests;
7 using Moq;
8 using NUnit.Framework;
9
10 namespace Agendas.Google.Test
11 {
12 [TestFixture]
13 public class GCalendarTest : TestBase
14 {
15 private readonly DateTime _fechaEvento = new DateTime(2011, 07, 16);
16
17 [Test]
18 public void CrearEventoGoogleCalendar()
19 {
20 var gCalendar = new GCalendarAdapter("VAN", ConfigurationManager.AppSettings["userNameGoogleCalendar"],
21 ConfigurationManager.AppSettings["passwordGoogleCalendar"],
22 ConfigurationManager.AppSettings["calendarIdGoogleCalendar"]);
23 var ev = Evento.Agendar("Evento Test", null, _fechaEvento, "url", TipoEvento.Cafe);
24 string message;
25 var detail = new CafeGEventDetail();
26 detail.Generate(ev);
27 var result = gCalendar.CreateEvent(detail, out message);
28
29 Assert.AreEqual(true, result);
30 Assert.AreEqual(message, "Event create successful");
31 }
32 [Test]
33 public void EliminarEventoGoogleCalendar()
34 {
35 var gCalendar = new GCalendarAdapter("VAN", ConfigurationManager.AppSettings["userNameGoogleCalendar"],
36 ConfigurationManager.AppSettings["passwordGoogleCalendar"],
37 ConfigurationManager.AppSettings["calendarIdGoogleCalendar"]);
38 string message;
39 var startEvent = new DateTime(_fechaEvento.Year, _fechaEvento.Month, _fechaEvento.Day, 18, 0, 0,
40 DateTimeKind.Utc);
41 var endEvent = new DateTime(_fechaEvento.Year, _fechaEvento.Month, _fechaEvento.Day, 20, 0, 0,
42 DateTimeKind.Utc);
43 var result = gCalendar.DeleteEvent(startEvent, endEvent, out message);
44
45 Assert.AreEqual(true, result);
46 Assert.AreEqual(message, "Event delete successful");
47 }
48 }
49 }