コード例 #1
0
        public void Test_CreateBroadcast_TextLocalTimeZoneRestrictionEndTimeOnly()
        {
            ExpectedBroadcastText = new CfBroadcast
            {
                Name = "Name",
                Type = CfBroadcastType.Text,
                Item = new CfTextBroadcastConfig
                {
                    FromNumber = VerifyShortCode,
                    LocalTimeZoneRestriction = new CfLocalTimeZoneRestriction
                    {
                        EndTime = new DateTime(2014, 01, 01, 17, 00, 00)
                    },
                    Message            = "Message Test",
                    BigMessageStrategy = CfBigMessageStrategy.DoNotSend
                },
            };
            var broadcastRequest = new CfBroadcastRequest(string.Empty, ExpectedBroadcastText);

            if (Client.GetType() == typeof(RestBroadcastClient))
            {
                var id = Client.CreateBroadcast(broadcastRequest);
                Assert.IsNotNull(id);
            }
            else
            {
                Assert.Throws <FaultException <ServiceFaultInfo> >(() => Client.CreateBroadcast(broadcastRequest));
            }
        }
コード例 #2
0
        public void Test_UpdateBroadcast()
        {
            var broadcast        = new CfBroadcast(BroadcastId, BroadcastName, CfBroadcastStatus.Running, DateTime.Now, CfBroadcastType.Text, null);
            var broadcastRequest = new CfBroadcastRequest("", broadcast);

            Client.UpdateBroadcast(broadcastRequest);
        }
コード例 #3
0
 public Broadcast(CfBroadcast source)
 {
     if (source.Id.HasValue)
     {
         id          = source.Id.Value;
         idSpecified = true;
     }
     Name = source.Name;
     if (source.Status.HasValue)
     {
         Status          = EnumeratedMapper.ToSoapEnumerated <BroadcastStatus>(source.Status.ToString());
         StatusSpecified = true;
     }
     if (source.LastModified.HasValue)
     {
         LastModified          = source.LastModified.Value;
         LastModifiedSpecified = true;
     }
     if (source.Type.HasValue)
     {
         Type          = EnumeratedMapper.ToSoapEnumerated <BroadcastType>(source.Type.ToString());
         Item          = BroadcastConfigMapper.ToBroadcastConfig(source.Item, source.Type.Value);
         TypeSpecified = true;
     }
 }
コード例 #4
0
        public void Test_CreateBroadcast_VoiceRetryConfigComplete()
        {
            ExpectedBroadcastVoice = new CfBroadcast
            {
                Name = "Name",
                Type = CfBroadcastType.Voice,
                Item = new CfVoiceBroadcastConfig
                {
                    FromNumber            = VerifyFromNumber,
                    Item                  = "TTS: eeee",
                    MachineSoundTextVoice = "SPANISH1",
                    Item1                 = "TTS: eeee",
                    RetryConfig           = new CfBroadcastConfigRetryConfig
                    {
                        MaxAttempts            = 2,
                        MinutesBetweenAttempts = 5,
                        RetryPhoneTypes        = new[] { CfRetryPhoneType.HomePhone },
                        RetryResults           = new[] { CfResult.NoAns }
                    }
                },
            };
            var broadcastRequest = new CfBroadcastRequest(string.Empty, ExpectedBroadcastVoice);
            var id = Client.CreateBroadcast(broadcastRequest);

            Assert.IsNotNull(id);
        }
コード例 #5
0
        public void Test_CreateBroadcast_VoiceLocalTimeZoneRestrictionBeginTimeOnly()
        {
            ExpectedBroadcastVoice = new CfBroadcast
            {
                Name = "Name",
                Type = CfBroadcastType.Voice,
                Item = new CfVoiceBroadcastConfig
                {
                    FromNumber               = VerifyFromNumber,
                    Item                     = "TTS: eeee",
                    MachineSoundTextVoice    = "SPANISH1",
                    Item1                    = "TTS: eeee",
                    LocalTimeZoneRestriction = new CfLocalTimeZoneRestriction
                    {
                        BeginTime = new DateTime(2014, 01, 01, 09, 00, 00),
                    },
                },
            };
            var broadcastRequest = new CfBroadcastRequest(string.Empty, ExpectedBroadcastVoice);

            if (Client.GetType() == typeof(RestBroadcastClient))
            {
                var id = Client.CreateBroadcast(broadcastRequest);
                Assert.IsNotNull(id);
            }
            else
            {
                Assert.Throws <FaultException <ServiceFaultInfo> >(() => Client.CreateBroadcast(broadcastRequest));
            }
        }
コード例 #6
0
        public void FixtureSetup()
        {
            HttpClientMock = MockRepository.GenerateMock <IHttpClient>();
            Client         = new RestBroadcastClient(HttpClientMock);

            ExpectedBroadcast = new CfBroadcast(1, "broadcast", CfBroadcastStatus.Running, DateTime.Now, CfBroadcastType.Voice, null);

            CreateExpectedBroadcast(1);

            LocalTimeZoneRestriction = new CfLocalTimeZoneRestriction(DateTime.Now, DateTime.Now);
            CfResult[]         result     = { CfResult.Received };
            CfRetryPhoneType[] phoneTypes = { CfRetryPhoneType.FirstNumber };
            BroadcastConfigRestryConfig = new CfBroadcastConfigRetryConfig(1000, 2, result, phoneTypes);

            ExpectedVoiceBroadcastConfig = new CfVoiceBroadcastConfig(1, DateTime.Now, "fromNumber",
                                                                      null, BroadcastConfigRestryConfig, CfAnsweringMachineConfig.AmAndLive, "item",
                                                                      "liveSoundTextVoice", "item1", "machineSoundTextVoice", "item2", "tranferSoudnTextVoice", "1", "123456",
                                                                      "item3", "DncSoundTextVoice", "1", 5);
            ExpectedBroadcast.Item = ExpectedVoiceBroadcastConfig;

            CreateExpectedBroadcast(2);

            ExpectedVoiceBroadcastConfig.LocalTimeZoneRestriction = LocalTimeZoneRestriction;
            ExpectedVoiceBroadcastConfig.RetryConfig = null;
            ExpectedBroadcast.Item = ExpectedVoiceBroadcastConfig;

            CreateExpectedBroadcast(3);

            var resource = new Resource {
                Resources = null
            };

            GetValue(10, resource);
        }
コード例 #7
0
        public void FixtureSetup()
        {
            Client          = new SoapLabelClient(MockClient.User(), MockClient.Password());
            BroadcastClient = new SoapBroadcastClient(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 expectedTextBroadcastConfig = new CfTextBroadcastConfig(1, DateTime.Now, null, localTimeZoneRestriction, broadcastConfigRestryConfig, "Test", CfBigMessageStrategy.DoNotSend);
            var expectedBroadcast           = new CfBroadcast(14898, "broadcastSoap", CfBroadcastStatus.Running, DateTime.Now, CfBroadcastType.Text, expectedTextBroadcastConfig);
            var broadcastRequest            = new CfBroadcastRequest("", expectedBroadcast);

            BroadcastId = BroadcastClient.CreateBroadcast(broadcastRequest);

            LabelName = "New SoapLabel";

            Broadcast = new CfBroadcast
            {
                Name = "Name",
                Type = CfBroadcastType.Text,
                Item = new CfTextBroadcastConfig
                {
                    FromNumber  = VerifyShortCode,
                    RetryConfig = new CfBroadcastConfigRetryConfig
                    {
                        RetryPhoneTypes = new[] { CfRetryPhoneType.FirstNumber },
                        RetryResults    = new[] { CfResult.NoAns }
                    },
                    Message = "Message Test",
                },
            };
        }
コード例 #8
0
        public void FixtureSetup()
        {
            BroadcastServiceMock = MockRepository.GenerateStub <IBroadcastServicePortTypeClient>();
            Client            = new SoapBroadcastClient(BroadcastServiceMock);
            ExpectedBroadcast = new CfBroadcast(1, "broadcast", CfBroadcastStatus.Running, DateTime.Now, CfBroadcastType.Voice, null);

            CreateExpectedBroadcast(1);

            LocalTimeZoneRestriction = new CfLocalTimeZoneRestriction(DateTime.Now, DateTime.Now);
            CfResult[]         result     = { CfResult.CarrierTempError };
            CfRetryPhoneType[] phoneTypes = { CfRetryPhoneType.FirstNumber };
            BroadcastConfigRestryConfig = new CfBroadcastConfigRetryConfig(1000, 2, result, phoneTypes);

            ExpectedVoiceBroadcastConfig = new CfVoiceBroadcastConfig(1, DateTime.Now, "fromNumber",
                                                                      null, BroadcastConfigRestryConfig, CfAnsweringMachineConfig.AmAndLive, "item",
                                                                      "liveSoundTextVoice", "item1", "machineSoundTextVoice", "item2", "tranferSoudnTextVoice", "1", "123456",
                                                                      "item3", "DncSoundTextVoice", "1", 5);
            ExpectedBroadcast.Item = ExpectedVoiceBroadcastConfig;

            CreateExpectedBroadcast(2);

            ExpectedVoiceBroadcastConfig.LocalTimeZoneRestriction = LocalTimeZoneRestriction;
            ExpectedVoiceBroadcastConfig.RetryConfig = null;
            ExpectedBroadcast.Item = ExpectedVoiceBroadcastConfig;

            CreateExpectedBroadcast(3);
        }
コード例 #9
0
        public void FixtureSetup()
        {
            HttpClientMock = MockRepository.GenerateMock <IHttpClient>();
            Client         = new RestBroadcastClient(HttpClientMock);

            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 expectedTextBroadcastConfig = new CfTextBroadcastConfig(1, DateTime.Now, "fromNumber", localTimeZoneRestriction, broadcastConfigRestryConfig, "Test", CfBigMessageStrategy.DoNotSend);

            ExpectedBroadcast = new CfBroadcast(1894, "broadcast", CfBroadcastStatus.Running, DateTime.Now, CfBroadcastType.Text, expectedTextBroadcastConfig);

            var response = string.Format(
                "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>" +
                "<r:ResourceReference xmlns=\"http://api.callfire.com/data\" xmlns:r=\"http://api.callfire.com/resource\">" +
                "<r:Id>{0}</r:Id>" +
                "<r:Location>https://www.callfire.com/api/1.1/rest/broadcast/{0}</r:Location>" +
                "</r:ResourceReference>", ExpectedBroadcast.Id);

            HttpClientMock
            .Stub(j => j.Send(Arg <string> .Is.Equal("/broadcast"),
                              Arg <HttpMethod> .Is.Equal(HttpMethod.Post),
                              Arg <BroadcastRequest> .Matches(x => x.Broadcast.id == ExpectedBroadcast.Id &&
                                                              x.Broadcast.Name == ExpectedBroadcast.Name &&
                                                              x.Broadcast.LastModified == ExpectedBroadcast.LastModified &&
                                                              x.Broadcast.Status == BroadcastStatus.RUNNING &&
                                                              x.Broadcast.Type == BroadcastType.TEXT)))
            .Return(response);
        }
コード例 #10
0
        public void Test_CreateBroadcast()
        {
            var broadcast        = new CfBroadcast(ExpectedBroadcast.Id, ExpectedBroadcast.Name, ExpectedBroadcast.Status, ExpectedBroadcast.LastModified, ExpectedBroadcast.Type, ExpectedBroadcast.Item);
            var broadcastRequest = new CfBroadcastRequest("", broadcast);

            var id = Client.CreateBroadcast(broadcastRequest);

            Assert.AreEqual(ExpectedBroadcast.Id, id);
        }
コード例 #11
0
        public void Test_CreateBroadcast_WithNameOnly()
        {
            ExpectedBroadcast = new CfBroadcast
            {
                Name = "Name"
            };

            var broadcastRequest = new CfBroadcastRequest(null, ExpectedBroadcast);

            AssertClientException <WebException, FaultException>(() => Client.CreateBroadcast(broadcastRequest));
        }
コード例 #12
0
        public void Test_CreateBroadcast_WithNameandTypeVoice()
        {
            ExpectedBroadcast = new CfBroadcast
            {
                Name = "Name",
                Type = CfBroadcastType.Voice
            };

            var broadcastRequest = new CfBroadcastRequest(null, ExpectedBroadcast);

            AssertClientException <WebException, FaultException>(() => Client.CreateBroadcast(broadcastRequest));
        }
コード例 #13
0
        public void Test_UpdateBroadcastChangeTypeVoice()
        {
            ExpectedBroadcastVoice = new CfBroadcast
            {
                Name = "Name",
                Type = CfBroadcastType.Voice,
                Item = new CfVoiceBroadcastConfig
                {
                    FromNumber            = VerifyFromNumber,
                    Item                  = "TTS: eeee",
                    MachineSoundTextVoice = "SPANISH1",
                    Item1                 = "TTS: eeee",
                    RetryConfig           = new CfBroadcastConfigRetryConfig
                    {
                        MaxAttempts            = 2,
                        MinutesBetweenAttempts = 5,
                        RetryPhoneTypes        = new[] { CfRetryPhoneType.HomePhone },
                        RetryResults           = new[] { CfResult.NoAns }
                    }
                },
            };
            var id = Client.CreateBroadcast(new CfBroadcastRequest(string.Empty, ExpectedBroadcastVoice));

            const string newName        = "changeType";
            const long   newSoundId     = 460759001;
            const int    newMaxAttempts = 10;

            ExpectedBroadcast = new CfBroadcast
            {
                Id   = id,
                Name = newName,
                Type = CfBroadcastType.Voice,
                Item = new CfVoiceBroadcastConfig
                {
                    FromNumber  = VerifyFromNumber,
                    Item        = newSoundId,
                    RetryConfig = new CfBroadcastConfigRetryConfig
                    {
                        MaxAttempts     = newMaxAttempts,
                        RetryPhoneTypes = new[] { CfRetryPhoneType.MobilePhone },
                    }
                },
            };
            Client.UpdateBroadcast(new CfBroadcastRequest(string.Empty, ExpectedBroadcast));
            var broadcast = Client.GetBroadcast(id);

            Assert.AreEqual(newName, broadcast.Name);
            Assert.AreEqual(newSoundId, ((CfVoiceBroadcastConfig)broadcast.Item).Item);
            Assert.AreEqual(newMaxAttempts, broadcast.Item.RetryConfig.MaxAttempts);
            Assert.IsTrue(broadcast.Item.RetryConfig.RetryPhoneTypes.Any(t => t.Equals(CfRetryPhoneType.MobilePhone)));
        }
コード例 #14
0
        public void FixtureSetup()
        {
            BroadcastServiceMock = MockRepository.GenerateStub <IBroadcastServicePortTypeClient>();
            Client = new SoapBroadcastClient(BroadcastServiceMock);

            ExpectedBroadcast = new CfBroadcast(1, "broadcast", CfBroadcastStatus.Running, DateTime.Now, CfBroadcastType.Text, null);

            BroadcastServiceMock
            .Stub(b => b.CreateBroadcast(Arg <BroadcastRequest> .Matches(x => x.Broadcast.id == ExpectedBroadcast.Id &&
                                                                         x.Broadcast.Name == ExpectedBroadcast.Name &&
                                                                         x.Broadcast.LastModified == ExpectedBroadcast.LastModified &&
                                                                         x.Broadcast.Status == BroadcastStatus.RUNNING &&
                                                                         x.Broadcast.Type == BroadcastType.TEXT)))
            .Return(ExpectedBroadcast.Id == null ? 0 : ExpectedBroadcast.Id.Value);
        }
コード例 #15
0
 public void Test_UpdateBroadcastChangeTypeINVALID()
 {
     ExpectedBroadcast = new CfBroadcast
     {
         Id   = 789,
         Name = "changeType",
         Type = CfBroadcastType.Ivr,
         Item = new CfIvrBroadcastConfig
         {
             FromNumber  = VerifyFromNumber,
             DialplanXml = "<dialplan><play type=\"tts\">Fail Updated DialplanXml</play></dialplan>",
         },
     };
     AssertClientException <WebException, FaultException <ServiceFaultInfo> >(() => Client.UpdateBroadcast(new CfBroadcastRequest(string.Empty, ExpectedBroadcast)));
 }
コード例 #16
0
        public void Test_CreateBroadcast_IvrBroadcastConfigComplete()
        {
            ExpectedBroadcastIvr = new CfBroadcast
            {
                Name = "Name",
                Type = CfBroadcastType.Ivr,
                Item = new CfIvrBroadcastConfig
                {
                    FromNumber  = VerifyFromNumber,
                    DialplanXml = "<dialplan><play type=\"tts\">Congratulations! You have successfully configured a CallFire I V R.</play></dialplan>"
                },
            };
            var broadcastRequest = new CfBroadcastRequest(string.Empty, ExpectedBroadcastIvr);
            var id = Client.CreateBroadcast(broadcastRequest);

            Assert.IsNotNull(id);
        }
コード例 #17
0
        public void Test_CreateBroadcast_VoiceBroadcastConfigFaildNumber()
        {
            ExpectedBroadcastVoice = new CfBroadcast
            {
                Name = "Name",
                Type = CfBroadcastType.Voice,
                Item = new CfVoiceBroadcastConfig
                {
                    FromNumber            = "45879163710",
                    Item                  = "TTS: eeee",
                    MachineSoundTextVoice = "SPANISH1",
                    Item1                 = "TTS: eeee"
                },
            };
            var broadcastRequest = new CfBroadcastRequest(string.Empty, ExpectedBroadcastVoice);

            AssertClientException <WebException, FaultException <ServiceFaultInfo> >(() => Client.CreateBroadcast(broadcastRequest));
        }
コード例 #18
0
        public void Test_CreateBroadcast_VoiceBroadcastConfigComplete()
        {
            ExpectedBroadcastVoice = new CfBroadcast
            {
                Name = "Name",
                Type = CfBroadcastType.Voice,
                Item = new CfVoiceBroadcastConfig
                {
                    FromNumber            = VerifyFromNumber,
                    Item                  = "TTS: eeee",
                    MachineSoundTextVoice = "SPANISH1",
                    Item1                 = "TTS: eeee",
                },
            };
            var broadcastRequest = new CfBroadcastRequest(string.Empty, ExpectedBroadcastVoice);
            var id = Client.CreateBroadcast(broadcastRequest);

            Assert.IsNotNull(id);
        }
コード例 #19
0
        public void Test_CreateBroadcast_TextRetryConfigMessage160caracters()
        {
            ExpectedBroadcastText = new CfBroadcast
            {
                Name = "Name",
                Type = CfBroadcastType.Text,
                Item = new CfTextBroadcastConfig
                {
                    Id                 = 1,
                    Created            = new DateTime(2012, 10, 26),
                    FromNumber         = VerifyShortCode,
                    Message            = "Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adineque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adi",
                    BigMessageStrategy = CfBigMessageStrategy.SendMultiple
                },
            };
            var broadcastRequest = new CfBroadcastRequest(string.Empty, ExpectedBroadcastText);
            var id = Client.CreateBroadcast(broadcastRequest);

            Assert.IsNotNull(id);
        }
コード例 #20
0
        public void Test_CreateBroadcast_IvrRetryConfigNODialplanXml()
        {
            ExpectedBroadcastIvr = new CfBroadcast
            {
                Name = "Name",
                Type = CfBroadcastType.Ivr,
                Item = new CfIvrBroadcastConfig
                {
                    FromNumber  = VerifyFromNumber,
                    RetryConfig = new CfBroadcastConfigRetryConfig
                    {
                        RetryPhoneTypes = new[] { CfRetryPhoneType.FirstNumber },
                        RetryResults    = new[] { CfResult.TooBig }
                    },
                },
            };
            var broadcastRequest = new CfBroadcastRequest(string.Empty, ExpectedBroadcastIvr);

            AssertClientException <WebException, FaultException <ServiceFaultInfo> >(() => Client.CreateBroadcast(broadcastRequest));
        }
コード例 #21
0
        public void Test_CreateBroadcast_IvrRetryConfigINVALIDDialplanXml()
        {
            ExpectedBroadcastIvr = new CfBroadcast
            {
                Name = "Name",
                Type = CfBroadcastType.Ivr,
                Item = new CfIvrBroadcastConfig
                {
                    FromNumber  = VerifyFromNumber,
                    DialplanXml = "<dialplan><play type=\"tts\">Congratulations! You have successfully configured a CallFire I V R.",
                    RetryConfig = new CfBroadcastConfigRetryConfig
                    {
                        RetryPhoneTypes = new[] { CfRetryPhoneType.WorkPhone },
                        RetryResults    = new[] { CfResult.CarrierError }
                    },
                },
            };
            var broadcastRequest = new CfBroadcastRequest(string.Empty, ExpectedBroadcastIvr);

            AssertClientException <WebException, FaultException <ServiceFaultInfo> >(() => Client.CreateBroadcast(broadcastRequest));
        }
コード例 #22
0
        public void Test_UpdateBroadcastChangeTypeText()
        {
            ExpectedBroadcastText = new CfBroadcast
            {
                Name = "Name",
                Type = CfBroadcastType.Text,
                Item = new CfTextBroadcastConfig
                {
                    FromNumber         = VerifyShortCode,
                    RetryConfig        = new CfBroadcastConfigRetryConfig(),
                    Message            = "Message Test",
                    BigMessageStrategy = CfBigMessageStrategy.DoNotSend
                },
            };

            var id = Client.CreateBroadcast(new CfBroadcastRequest(string.Empty, ExpectedBroadcastText));

            const string newName    = "changeTypeText";
            const string newMessage = "UpdateMessage";
            const CfBigMessageStrategy newBigMessageStrategy = CfBigMessageStrategy.SendMultiple;

            ExpectedBroadcast = new CfBroadcast
            {
                Id   = id,
                Name = newName,
                Type = CfBroadcastType.Text,
                Item = new CfTextBroadcastConfig
                {
                    FromNumber         = VerifyShortCode,
                    Message            = newMessage,
                    BigMessageStrategy = newBigMessageStrategy
                },
            };
            Client.UpdateBroadcast(new CfBroadcastRequest(string.Empty, ExpectedBroadcast));
            var broadcast = Client.GetBroadcast(id);

            Assert.AreEqual(newName, broadcast.Name);
            Assert.AreEqual(newMessage, ((CfTextBroadcastConfig)broadcast.Item).Message);
            Assert.AreEqual(newBigMessageStrategy, ((CfTextBroadcastConfig)broadcast.Item).BigMessageStrategy);
        }
コード例 #23
0
        public void Test_CreateBroadcast_IvrLocalTimeZoneRestrictionComplete()
        {
            ExpectedBroadcastIvr = new CfBroadcast
            {
                Name = "Name",
                Type = CfBroadcastType.Ivr,
                Item = new CfIvrBroadcastConfig
                {
                    FromNumber  = VerifyFromNumber,
                    DialplanXml = "<dialplan><play type=\"tts\">Congratulations! You have successfully configured a CallFire I V R.</play></dialplan>",
                    LocalTimeZoneRestriction = new CfLocalTimeZoneRestriction
                    {
                        BeginTime = new DateTime(2014, 01, 01, 09, 00, 00),
                        EndTime   = new DateTime(2014, 01, 01, 17, 00, 00)
                    }
                },
            };
            var broadcastRequest = new CfBroadcastRequest(string.Empty, ExpectedBroadcastIvr);
            var id = Client.CreateBroadcast(broadcastRequest);

            Assert.IsNotNull(id);
        }
コード例 #24
0
        public void Test_CreateBroadcast_IvrRetryConfigVALIDDialplanXml()
        {
            ExpectedBroadcastIvr = new CfBroadcast
            {
                Name = "Name",
                Type = CfBroadcastType.Ivr,
                Item = new CfIvrBroadcastConfig
                {
                    FromNumber  = VerifyFromNumber,
                    DialplanXml = "<dialplan><play type=\"tts\">Congratulations! You have successfully configured a CallFire I V R.</play></dialplan>",
                    RetryConfig = new CfBroadcastConfigRetryConfig
                    {
                        RetryPhoneTypes = new[] { CfRetryPhoneType.WorkPhone },
                        RetryResults    = new[] { CfResult.InternalError }
                    },
                },
            };
            var broadcastRequest = new CfBroadcastRequest(string.Empty, ExpectedBroadcastIvr);
            var id = Client.CreateBroadcast(broadcastRequest);

            Assert.IsNotNull(id);
        }
コード例 #25
0
        public void Test_CreateBroadcast_TextRetryConfigMessage161caractersANDRetryResultsSENT()
        {
            ExpectedBroadcastText = new CfBroadcast
            {
                Name = "Name",
                Type = CfBroadcastType.Text,
                Item = new CfTextBroadcastConfig
                {
                    FromNumber  = VerifyShortCode,
                    RetryConfig = new CfBroadcastConfigRetryConfig
                    {
                        RetryPhoneTypes = new[] { CfRetryPhoneType.FirstNumber },
                        RetryResults    = new[] { CfResult.Sent }
                    },
                    Message            = "Xneque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adineque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adi",
                    BigMessageStrategy = CfBigMessageStrategy.DoNotSend
                },
            };
            var broadcastRequest = new CfBroadcastRequest(string.Empty, ExpectedBroadcastText);
            var id = Client.CreateBroadcast(broadcastRequest);

            Assert.IsNotNull(id);
        }
コード例 #26
0
        public void Test_CreateBroadcast_VoiceRetryConfigCompleteItem_Item1_Item2_Item3Long()
        {
            ExpectedBroadcastVoice = new CfBroadcast
            {
                Name = "Name",
                Type = CfBroadcastType.Voice,
                Item = new CfVoiceBroadcastConfig
                {
                    FromNumber            = VerifyFromNumber,
                    Item                  = 460760001,
                    MachineSoundTextVoice = "SPANISH1",
                    Item1                 = 460760001,
                    RetryConfig           = new CfBroadcastConfigRetryConfig
                    {
                        RetryResults = new[] { CfResult.La }
                    }
                },
            };
            var broadcastRequest = new CfBroadcastRequest(string.Empty, ExpectedBroadcastVoice);
            var id = Client.CreateBroadcast(broadcastRequest);

            Assert.IsNotNull(id);
        }
コード例 #27
0
        public void Test_CreateBroadcast_TextRetryConfigNotAllComplete()
        {
            ExpectedBroadcastText = new CfBroadcast
            {
                Name = "Name",
                Type = CfBroadcastType.Text,
                Item = new CfTextBroadcastConfig
                {
                    FromNumber  = VerifyShortCode,
                    RetryConfig = new CfBroadcastConfigRetryConfig
                    {
                        RetryPhoneTypes = new[] { CfRetryPhoneType.FirstNumber },
                        RetryResults    = new[] { CfResult.NoAns }
                    },
                    Message            = "Message Test",
                    BigMessageStrategy = CfBigMessageStrategy.Trim
                },
            };
            var broadcastRequest = new CfBroadcastRequest(string.Empty, ExpectedBroadcastText);
            var id = Client.CreateBroadcast(broadcastRequest);

            Assert.IsNotNull(id);
        }
コード例 #28
0
        public void Test_UpdateBroadcastChangeTypeIVR()
        {
            ExpectedBroadcastIvr = new CfBroadcast
            {
                Name = "Name",
                Type = CfBroadcastType.Ivr,
                Item = new CfIvrBroadcastConfig
                {
                    FromNumber  = VerifyFromNumber,
                    DialplanXml =
                        "<dialplan><play type=\"tts\">Congratulations! You have successfully configured a CallFire I V R.</play></dialplan>",
                    RetryConfig = new CfBroadcastConfigRetryConfig(),
                },
            };
            var id = Client.CreateBroadcast(new CfBroadcastRequest(string.Empty, ExpectedBroadcastIvr));

            const string newName        = "changeTypeIVR";
            const string newDialplanXml = "<dialplan><play type=\"tts\">Updated DialplanXml</play></dialplan>";

            ExpectedBroadcast = new CfBroadcast
            {
                Id   = id,
                Name = newName,
                Type = CfBroadcastType.Ivr,
                Item = new CfIvrBroadcastConfig
                {
                    FromNumber  = VerifyFromNumber,
                    DialplanXml = newDialplanXml,
                },
            };

            Client.UpdateBroadcast(new CfBroadcastRequest(string.Empty, ExpectedBroadcast));
            var broadcast = Client.GetBroadcast(id);

            Assert.AreEqual(newName, broadcast.Name);
            Assert.AreEqual(newDialplanXml, ((CfIvrBroadcastConfig)broadcast.Item).DialplanXml);
        }
コード例 #29
0
        public void Test_CreateBroadcast_VoiceLocalTimeZoneRestrictionComplete()
        {
            ExpectedBroadcastVoice = new CfBroadcast
            {
                Name = "Name",
                Type = CfBroadcastType.Voice,
                Item = new CfVoiceBroadcastConfig
                {
                    FromNumber               = VerifyFromNumber,
                    Item                     = "TTS: eeee",
                    MachineSoundTextVoice    = "SPANISH1",
                    Item1                    = "TTS: eeee",
                    LocalTimeZoneRestriction = new CfLocalTimeZoneRestriction
                    {
                        BeginTime = new DateTime(2014, 01, 01, 09, 00, 00),
                        EndTime   = new DateTime(2014, 01, 01, 17, 00, 00)
                    },
                },
            };
            var broadcastRequest = new CfBroadcastRequest(string.Empty, ExpectedBroadcastVoice);
            var id = Client.CreateBroadcast(broadcastRequest);

            Assert.IsNotNull(id);
        }
コード例 #30
0
        public void FixtureSetup()
        {
            Client = new RestBroadcastClient(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 expectedTextBroadcastConfig = new CfTextBroadcastConfig(1, DateTime.Now, string.Empty, localTimeZoneRestriction,
                                                                        broadcastConfigRestryConfig, "Test", CfBigMessageStrategy.DoNotSend);

            ExpectedBroadcastDefault = new CfBroadcast(14898, "broadcastRest", CfBroadcastStatus.StartPending, DateTime.Now,
                                                       CfBroadcastType.Text, expectedTextBroadcastConfig);

            CfBroadcastType[] broadcastType = { CfBroadcastType.Text };
            CfQueryBroadcasts = new CfQueryBroadcasts(100, 0, broadcastType, null, null);

            QueryContactBatches   = new CfQueryBroadcastData(100, 0, 1838228001);
            ControlContactBatches = new CfControlContactBatch(1092170001, "ContactBatchRest", true);
            GetBroadcastStats     = new CfGetBroadcastStats(1838228001, new DateTime(2014, 01, 01), new DateTime(2014, 12, 01));

            var textBroadcastConfig = new CfTextBroadcastConfig(1, DateTime.Now, "67076", null, null,
                                                                "Test Message Rest", CfBigMessageStrategy.DoNotSend);
            var broadcast = new CfBroadcast(1838228001, "broadcastUpdated_Rest", CfBroadcastStatus.Running, DateTime.Now,
                                            CfBroadcastType.Text, textBroadcastConfig);

            UpdateBroadcast = new CfBroadcastRequest("", broadcast);

            ControlBroadcast = new CfControlBroadcast(0, null, CfBroadcastCommand.Archive, null);

            const long id = 188717001;

            object[] contactList = { id };
            CreateContactBatch = new CfCreateContactBatch(null, 1907978001, "ContactBatchSoap", contactList, false);
        }