view Agendas/trunk/src/Agendas.Google.Test/GCalendarTest.cs @ 208:607384590bf8

Mejorando el mensaje de error que se muestra cuando hay un error de validación del lado del servidor
author nelopauselli
date Wed, 24 Aug 2011 11:30:06 -0300
parents 2d02adb79322
children c61954d24c8c
line wrap: on
line source

using System;
using AltNetHispano.Agendas.Domain;
using AltNetHispano.Agendas.Google;
using AltNetHispano.Agendas.Google.DetailsEvents;
using AltNetHispano.Agendas.Tests;
using NUnit.Framework;

namespace Agendas.Google.Test
{
    [TestFixture]
    public class GCalendarTest : TestBase
    {
        private readonly DateTime _fechaEvento = new DateTime(2011, 07, 16, 18, 0, 0, DateTimeKind.Utc);
        private readonly DateTime _fechaTermino = new DateTime(2011, 07, 16, 20, 0, 0, DateTimeKind.Utc);

        [Test]
        public void CrearEventoGoogleCalendar()
        {
            var gCalendar = new GCalendarAdapter("VAN");
            var ev = Evento.Agendar("Evento Test", null, _fechaEvento, _fechaTermino, "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");
            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");
        }
    }
}