예제 #1
0
 public void ApiVersionTest()
 {
     var target = new SMSMessage(); // TODO: Initialize to an appropriate value
     var expected = string.Empty; // TODO: Initialize to an appropriate value
     target.api_version = expected;
     var actual = target.api_version;
     Assert.AreEqual(expected, actual);
     Assert.Inconclusive("Verify the correctness of this test method.");
 }
예제 #2
0
 public void PriceTest()
 {
     var target = new SMSMessage(); // TODO: Initialize to an appropriate value
     target.price = null;
     var actual = target.price;
     Assert.AreEqual(null, actual);
     Assert.Inconclusive("Verify the correctness of this test method.");
 }
예제 #3
0
        public SMSMessage SendSMSMessage(String from, String to, String body, String statusCallback = "")
        {
            _parameters.Clear();
            _parameters.Add("From", from);
            _parameters.Add("To", to);
            _parameters.Add("Body", body);
            if (!String.IsNullOrEmpty(statusCallback))
            {
                _parameters.Add("StatusCallback", statusCallback);
            }

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

            var sms = new SMSMessage
            {
                account_sid = data.account_sid,
                api_version = data.api_version,
                body = data.body,
                date_created = !String.IsNullOrEmpty(data.date_created) ? Convert.ToDateTime(data.date_created) : null,
                date_sent = !String.IsNullOrEmpty(data.date_sent) ? Convert.ToDateTime(data.date_sent) : null,
                date_updated = !String.IsNullOrEmpty(data.date_updated) ? Convert.ToDateTime(data.date_updated) : null,
                direction = data.direction,
                from = data.from,
                price = !String.IsNullOrEmpty(data.price) ? Convert.ToDecimal(data.price) : null,
                sid = data.sid,
                status = data.status,
                to = data.to,
                uri = data.uri
            };

            return sms;
        }
예제 #4
0
 public void DateUpdatedTest()
 {
     var target = new SMSMessage {date_updated = null}; // TODO: Initialize to an appropriate value
     DateTime? actual = target.date_updated;
     Assert.AreEqual(null, actual);
     Assert.Inconclusive("Verify the correctness of this test method.");
 }
예제 #5
0
        public SMSMessage GetSMSMessage(String sid)
        {
            _parameters.Clear();

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

            var smsMessages = new SMSMessage {
                account_sid = data.account_sid,
                api_version = data.api_version,
                body = data.body,
                date_created = !String.IsNullOrEmpty(data.date_created) ? Convert.ToDateTime(data.date_created) : null,
                date_sent = !String.IsNullOrEmpty(data.date_sent) ? Convert.ToDateTime(data.date_sent) : null,
                date_updated = !String.IsNullOrEmpty(data.date_updated) ? Convert.ToDateTime(data.date_updated) : null,
                direction = data.direction,
                from = data.from,
                price = !String.IsNullOrEmpty(data.price) ? Convert.ToDecimal(data.price) : null,
                sid = data.sid,
                status = data.status,
                to = data.to,
                uri = data.uri
            };

            return smsMessages;
        }