Example #1
0
 public void EndTest()
 {
     var target = new SMS {end = null}; // TODO: Initialize to an appropriate value
     var actual = target.end;
     Assert.AreEqual(null, actual);
     Assert.Inconclusive("Verify the correctness of this test method.");
 }
Example #2
0
 public void FirstPageUriTest()
 {
     var target = new SMS(); // TODO: Initialize to an appropriate value
     var expected = string.Empty; // TODO: Initialize to an appropriate value
     target.first_page_uri = expected;
     var actual = target.first_page_uri;
     Assert.AreEqual(expected, actual);
     Assert.Inconclusive("Verify the correctness of this test method.");
 }
Example #3
0
        public SMS SMSMessageList(String to = "", String from = "", DateTime? dateSent = null)
        {
            _parameters.Clear();
            if (!String.IsNullOrEmpty(to))
            {
                _parameters.Add("To", to);
            }
            if (!String.IsNullOrEmpty(from))
            {
                _parameters.Add("From", from);
            }
            if (dateSent.HasValue)
            {
                _parameters.Add("DateSent", dateSent.Value);
            }

            _twilioResponse = _account.request(String.Format("Accounts/{0}/SMS/Messages.json", _account.id), "GET", _parameters);
            dynamic data = ParseResponseData(_twilioResponse);

            var sms = new SMS
            {
                start = data.start,
                total = data.total,
                num_pages = data.num_pages,
                page = data.page,
                page_size = data.page_size,
                end = data.end,
                uri = data.uri,
                first_page_uri = data.first_page_uri,
                last_page_uri = data.last_page_uri,
                next_page_uri = data.next_page_uri,
                previous_page_uri = data.previous_page_uri
            };

            IList<SMSMessage> messages = new List<SMSMessage>();

            foreach (dynamic item in data.sms_messages)
            {
                messages.Add(new SMSMessage {
                    account_sid = item.account_sid,
                    api_version = item.api_version,
                    body = item.body,
                    date_created = !String.IsNullOrEmpty(item.date_created) ? Convert.ToDateTime(item.date_created) : null,
                    date_sent = !String.IsNullOrEmpty(item.date_sent) ? Convert.ToDateTime(item.date_sent) : null,
                    date_updated = !String.IsNullOrEmpty(item.date_updated) ? Convert.ToDateTime(item.date_updated) : null,
                    direction = item.direction,
                    from = item.from,
                    price = !String.IsNullOrEmpty(item.price) ? Convert.ToDecimal(item.price) : null, 
                    sid = item.sid, 
                    status = item.status, 
                    to = item.to, 
                    uri = item.uri
                });
            }

            sms.sms_messages = messages;

            return sms;
        }