Exemplo n.º 1
0
 /// <summary>
 /// Constructor accepts a GCalRequest from which to generate a response
 /// </summary>
 /// <param name="request">Incoming request from which to generate a response</param>
 public GCalFreeBusyResponse(GCalFreeBusyRequest request)
 {
     escapedSubject    = new StringBuilder(256);
     escapedLocation   = new StringBuilder(1024);
     escapedOrganizer  = new StringBuilder(256);
     escapedCommonName = new StringBuilder(256);
     this.request      = request;
 }
Exemplo n.º 2
0
        /// <summary>
        /// Generate an error response from a request
        /// </summary>
        /// <param name="request">request that generated error</param>
        /// <param name="exception">The exception from the error</param>
        public GCalErrorResponse(GCalFreeBusyRequest request, GCalExchangeException exception)
        {
            if (request != null)
            {
                versionId = request.VersionNumber;
                messageId = request.MessageId;
            }

            errorMessage = exception.Message;
            errorId      = (int)(exception.ErrorCode);
        }
Exemplo n.º 3
0
        public void TestParseWithDomainMap()
        {
            string        id        = "test-id";
            List <string> srcEmails = new List <string>();

            srcEmails.Add("*****@*****.**");
            srcEmails.Add("*****@*****.**");
            srcEmails.Add("*****@*****.**");
            srcEmails.Add("*****@*****.**");

            List <string> dstEmails = new List <string>();

            dstEmails.Add("*****@*****.**");
            dstEmails.Add("*****@*****.**");
            dstEmails.Add("*****@*****.**");
            dstEmails.Add("*****@*****.**");

            DateTime start = DateUtil.ParseDateToUtc("2008-01-01T00:00:00.000Z");
            DateTime end   = DateUtil.ParseDateToUtc("2008-01-31T00:00:00.000Z");
            DateTime since = DateUtil.ParseDateToUtc("2008-01-01T00:00:00.000Z");
            string   tz    = "America/Los_Angeles";

            string query = string.Format("[ 1, {0}, [{1}], {2}/{3}, {4}, {5}]",
                                         id,
                                         createEmailList(srcEmails),
                                         createDate(start),
                                         createDate(end),
                                         createDateTime(since),
                                         tz);

            ConfigCache.AddDomainMap("example.org", "woot.org");

            GCalFreeBusyRequest request =
                new GCalFreeBusyRequest(query);

            Assert.AreEqual(start, request.StartDate);
            Assert.AreEqual(end, request.EndDate);
            Assert.AreEqual(since, request.Since);
            Assert.AreEqual(id, request.MessageId);
            Assert.AreEqual("1", request.VersionNumber);
            Assert.AreEqual(dstEmails.Count, request.ExchangeUsers.Length);

            for (int i = 0; i < request.ExchangeUsers.Length; i++)
            {
                Assert.AreEqual(dstEmails[i], request.ExchangeUsers[i]);
            }
        }