Пример #1
0
        public void TestGetEmailDetails()
        {
            List <TMSEmailMessage> messages = api.GetEmailMessages();

            Assert.IsNotNull(messages);
            Assert.IsTrue(messages.Count > 0);

            TMSEmailMessage message = messages.First <TMSEmailMessage>();

            Assert.IsNotNull(message);
            Assert.IsNotNull(message._links);
            Assert.IsNotNull(message._links["self"]);

            // body isn't available in the list view
            Assert.IsNull(message.body);

            message = api.Get <TMSEmailMessage>(message._links["self"]);

            // body should now be there
            Assert.IsNotNull(message.body);

            // recipients should not appear yet
            Assert.IsNull(message.recipients);

            // recipient counts are available though
            Assert.IsNotNull(message.recipient_counts);
            Assert.IsNotNull(message.recipient_counts["total"]);
            Assert.IsTrue(Convert.ToDecimal(message.recipient_counts["total"]) > 0);

            // open and link tracking fields are here
            Assert.IsNotNull(message.open_tracking_enabled);
            Assert.IsTrue(message.open_tracking_enabled == true || message.open_tracking_enabled == false);

            Assert.IsNotNull(message.click_tracking_enabled);
            Assert.IsTrue(message.click_tracking_enabled == true || message.click_tracking_enabled == false);

            // created_at should be a positive date
            Assert.IsNotNull(message.created_at);
            Assert.IsTrue(message.created_at > new DateTime(0));
        }
Пример #2
0
        public void TestGetSMSDetails()
        {
            List <TMSSMSMessage> messages = api.GetSMSMessages();

            Assert.IsNotNull(messages);
            Assert.IsTrue(messages.Count > 0);

            // Look at the last message in the list in case
            // you are running all of the tests and you just
            // inserted one, the recipient list may not be built
            TMSSMSMessage message = messages.Last <TMSSMSMessage>();

            Assert.IsNotNull(message);
            Assert.IsNotNull(message._links);
            Assert.IsNotNull(message._links["self"]);

            // body is available in the list view
            Assert.IsNotNull(message.body);

            message = api.Get <TMSSMSMessage>(message._links["self"]);

            // body is here too!
            Assert.IsNotNull(message.body);

            // recipients should not appear yet
            Assert.IsNull(message.recipients);

            // recipient counts are available though
            Assert.IsNotNull(message.recipient_counts);
            Assert.IsNotNull(message.recipient_counts["total"]);
            Assert.IsTrue(Convert.ToDecimal(message.recipient_counts["total"]) > 0);

            // created_at should be a positive date
            Assert.IsNotNull(message.created_at);
            Assert.IsTrue(message.created_at > new DateTime(0));
        }