public void GetOpenPriceTest() { ExchangeUtil eu = new ExchangeUtil(); Decimal d = eu.GetOpenPrice(ExchangeUtil.CurrencyPairCode.USDJPY); Assert.AreEqual(true, d > 0); }
public void GetExchangeRateTest() { ExchangeUtil eu = new ExchangeUtil(); DataTable dt = eu.GetExchangeRateTable(); Assert.AreEqual(EnumUtil.GetCount(typeof(ExchangeUtil.CurrencyPairCode)), dt.Rows.Count); }
/// <summary> /// Update appointments in an exchange user mailbox /// </summary> /// <param name="user">The user mailbox to update events in</param> /// <param name="appointments">The appointments to update</param> public virtual void UpdateAppointments(ExchangeUser user, List <Appointment> appointments) { string userMailbox = ExchangeUtil.GetDefaultCalendarUrl(exchangeServerUrl, user.AccountName); try { foreach (Appointment appt in appointments) { webDavQuery.UpdateAppointment(userMailbox, appt); } } catch (Exception ex) { throw new GCalExchangeException( GCalExchangeErrorCode.ExchangeUnreachable, "Error updating appointment", ex); } }
/// <summary> /// Returns appointments for the specified exchange user /// </summary> /// <param name="user">The user which appointments will be looked up for</param> /// <param name="window">The event window to return appointments for</param> /// <returns>The event appointments that were looked up</returns> public List <Appointment> Lookup(ExchangeUser user, DateTimeRange window) { /* Create a holder for appointments */ List <Appointment> appointments = new List <Appointment>(); if (!ConfigCache.EnableAppointmentLookup) { if (log.IsDebugEnabled) { log.DebugFormat("Appointment lookup supressed for {0}", user.Email); } return(appointments); } try { /* Attempt to retrieve the Exchanger user's appointments * This may fail if there is a permissions issue for this user's calendar */ string calendarUrl = ExchangeUtil.GetDefaultCalendarUrl(exchangeServerUrl, user); appointments = webDavQuery.LoadAppointments(calendarUrl, window.Start, window.End); user.AccessLevel = GCalAccessLevel.ReadAccess; user.HaveAppointmentDetail = true; log.InfoFormat( "Appointments read succesfully for '{0}', setting access level to ReadAccess.", user.Email); } catch (WebException ex) { log.InfoFormat("Appointment access denied for {0} - {1}", user.Email, ex); } catch (Exception ex) { string errorMessage = string.Format( "Error occured while retrieving appointments for user '{0}'", user.Email); throw new GCalExchangeException( GCalExchangeErrorCode.ExchangeUnreachable, errorMessage, ex); } return(appointments); }
public ExchangeGatewayTest() : base() { calendarUrl = ExchangeUtil.GetDefaultCalendarUrl(exchangeServer, "test"); _freeBusy = new List <DateTimeRange>(); _appointments = new List <Appointment>(); DateTime start = DateUtil.ParseDateToUtc("2007-06-30T05:16:11.000Z"); _window = new DateTimeRange(start, start.AddDays(60)); // One hour block as free busy AND appointment _freeBusy.Add(new DateTimeRange(start.AddHours(2), start.AddHours(3))); _appointments.Add(createAppointment(start.AddHours(2), start.AddHours(3))); // Two adjacent appointments - one free busy event start = start.AddDays(5); _freeBusy.Add(new DateTimeRange(start, start.AddMinutes(60))); _appointments.Add(createAppointment(start, start.AddMinutes(30))); _appointments.Add(createAppointment(start.AddMinutes(30), start.AddMinutes(60))); // Add event only to Free Busy start = start.AddDays(4); _freeBusy.Add(new DateTimeRange(start.AddMinutes(30), start.AddMinutes(50))); // Add event only to Appointments start = start.AddDays(20); _appointments.Add(createAppointment(start.AddMinutes(45), start.AddMinutes(50))); // Add all day appointment start = DateUtil.ParseDateToUtc("2007-07-30T00:00:00.000Z"); _appointments.Add(createAppointment(start, start.AddHours(24), true)); _freeBusy.Add(new DateTimeRange(start, start.AddHours(24))); // Add two appointments that start at the same time, // one overlapping and one not start = start.AddDays(2); _appointments.Add(createAppointment(start, start.AddHours(2))); _appointments.Add(createAppointment(start, start.AddHours(6))); _freeBusy.Add(new DateTimeRange(start, start.AddHours(2))); }
/// <summary> /// Write appointments to an exchange server mailbox /// </summary> /// <param name="user">The user mailbox to write appointments for</param> /// <param name="appointments">The Appointments to write</param> public virtual void WriteAppointments(ExchangeUser user, List <Appointment> appointments) { string calendarUrl = ExchangeUtil.GetDefaultCalendarUrl( exchangeServerUrl, user); try { foreach (Appointment appt in appointments) { webDavQuery.CreateAppointment(calendarUrl, appt); } } catch (Exception ex) { throw new GCalExchangeException( GCalExchangeErrorCode.ExchangeUnreachable, "Error writing appointment", ex); } }
public WebDavQueryTest() { calendarUrl = ExchangeUtil.GetDefaultCalendarUrl(exchangeServer, "test"); }