public void Test_SendTextCompleteText()
        {
            CfToNumber[] toNumberList = { new CfToNumber {
                                              Value = VerifyFromNumber, ClientData = "Client1"
                                          } };
            var          sendText = new CfSendText
            {
                ToNumber = toNumberList,
                ScrubBroadcastDuplicates = true,
                UseDefaultBroadcast      = true,
                Type                = CfBroadcastType.Text,
                BroadcastName       = "BroadcastName",
                TextBroadcastConfig = new CfTextBroadcastConfig
                {
                    Message                  = "Test message",
                    BigMessageStrategy       = CfBigMessageStrategy.DoNotSend,
                    FromNumber               = VerifyShortCode,
                    LocalTimeZoneRestriction = new CfLocalTimeZoneRestriction
                    {
                        BeginTime = new DateTime(2014, 01, 01, 12, 00, 00),
                        EndTime   = new DateTime(2014, 12, 01, 17, 00, 00)
                    },
                    RetryConfig = new CfBroadcastConfigRetryConfig
                    {
                        MaxAttempts            = 2,
                        MinutesBetweenAttempts = 5,
                        RetryResults           = new [] { CfResult.Am },
                        RetryPhoneTypes        = new [] { CfRetryPhoneType.FirstNumber }
                    }
                },
            };
            var id = Client.SendText(sendText);

            Assert.IsNotNull(id);
        }
        public void Test_SendTextWrongFormat()
        {
            var sendText = new CfSendText
            {
                TextBroadcastConfig = new CfTextBroadcastConfig
                {
                    Message = null
                }
            };

            AssertClientException <WebException, FaultException>(() => Client.SendText(sendText));
        }
 public SendText(CfSendText cfSendText)
 {
     RequestId                = cfSendText.RequestId;
     Type                     = EnumeratedMapper.ToSoapEnumerated <BroadcastType>(cfSendText.Type.ToString()).ToString();
     BroadcastName            = cfSendText.BroadcastName;
     ToNumber                 = ToNumberMapper.ToToNumber(cfSendText.ToNumber);
     ScrubBroadcastDuplicates = cfSendText.ScrubBroadcastDuplicates;
     Label                    = cfSendText.Labels;
     TextBroadcastConfig      = TextBroadcastConfigMapper.ToSoapTextBroadcastConfig(cfSendText.TextBroadcastConfig);
     if (cfSendText.BroadcastId.HasValue)
     {
         BroadcastId          = cfSendText.BroadcastId.Value;
         BroadcastIdSpecified = true;
     }
     UseDefaultBroadcast = cfSendText.UseDefaultBroadcast;
 }
        public void Test_SendTextMandatoryText()
        {
            CfToNumber[] toNumberList = { new CfToNumber {
                                              Value = VerifyFromNumber, ClientData = "Client1"
                                          } };
            var          sendText = new CfSendText
            {
                ToNumber            = toNumberList,
                UseDefaultBroadcast = true,
                Type = CfBroadcastType.Text,
                TextBroadcastConfig = new CfTextBroadcastConfig
                {
                    Message = "Test message",
                },
            };
            var id = Client.SendText(sendText);

            Assert.IsNotNull(id);
        }
        public void Test_SendTextIVRFaild()
        {
            CfToNumber[] toNumberList = { new CfToNumber {
                                              Value = VerifyFromNumber, ClientData = "Client1"
                                          } };
            var          sendText = new CfSendText
            {
                Type                = CfBroadcastType.Ivr,
                ToNumber            = toNumberList,
                TextBroadcastConfig = new CfTextBroadcastConfig
                {
                    Message     = "Test message",
                    RetryConfig = new CfBroadcastConfigRetryConfig
                    {
                        RetryResults = new[] { CfResult.Busy }
                    }
                }
            };

            AssertClientException <WebException, FaultException <ServiceFaultInfo> >(() => Client.SendText(sendText));
        }
Ejemplo n.º 6
0
        public void FixtureSetup()
        {
            Client = new RestTextClient(MockClient.User(), MockClient.Password());

            var localTimeZoneRestriction = new CfLocalTimeZoneRestriction(DateTime.Now, DateTime.Now);

            CfResult[]         result       = { CfResult.Received };
            CfRetryPhoneType[] phoneTypes   = { CfRetryPhoneType.FirstNumber };
            var broadcastConfigRestryConfig = new CfBroadcastConfigRetryConfig(1000, 2, result, phoneTypes);
            var textBroadcastConfig         = new CfTextBroadcastConfig(1, DateTime.Now, "14252163710", localTimeZoneRestriction, broadcastConfigRestryConfig, "Test", CfBigMessageStrategy.DoNotSend);

            var toNumber = new [] { new CfToNumber("Data", null, "14252163710") };
            var labels   = new string[] { "Test_Label_1", "Test_Label_2" };

            SendText = new CfSendText(String.Empty, CfBroadcastType.Text, "broadcastSoap", toNumber, false, labels, textBroadcastConfig, 1875873001, true);

            CfActionQuery = new CfActionQuery(100, 0, 1838228001, 1092170001, new[] { CfActionState.Ready }, null, false, new DateTime(2014, 1, 1),
                                              new DateTime(2014, 12, 1), null, null, null);

            QueryAutoReplies = new CfQueryAutoReplies(100, 0, null);
        }
Ejemplo n.º 7
0
        public long SendText(CfSendText cfSendText)
        {
            var resource = BaseRequest <ResourceReference>(HttpMethod.Post, new SendText(cfSendText), new CallfireRestRoute <Text>());

            return(resource.Id);
        }
Ejemplo n.º 8
0
 public long SendText(CfSendText cfSendText)
 {
     return(TextService.SendText(new SendText(cfSendText)));
 }