コード例 #1
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);
        }
コード例 #2
0
        public void FixtureSetup()
        {
            Client = new RestLabelClient(MockClient.User(), MockClient.Password());
            BroadcastClient = 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);

            var expectedBroadcast = new CfBroadcast(14898, "broadcastSoap", CfBroadcastStatus.Running, DateTime.Now, CfBroadcastType.Text, expectedTextBroadcastConfig);
            var broadcastRequest = new CfBroadcastRequest("", expectedBroadcast);

            BroadcastId = BroadcastClient.CreateBroadcast(broadcastRequest);

            LabelName = "New RestLabel";

            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",
                },
            };
        }
コード例 #3
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);
        }
        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);
        }
        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);
        }
コード例 #6
0
 protected CfBroadcastConfig(long?identifier, DateTime?created, string fromNumber,
                             CfLocalTimeZoneRestriction localTimeZoneRestriction, CfBroadcastConfigRetryConfig retryConfig)
 {
     Id         = identifier;
     Created    = created;
     FromNumber = fromNumber;
     LocalTimeZoneRestriction = localTimeZoneRestriction;
     RetryConfig = retryConfig;
 }
 internal static BroadcastConfigRetryConfig ToBroadcastConfigRetryConfig(CfBroadcastConfigRetryConfig source)
 {
     if (source == null)
     {
         return null;
     }
     var retry = EnumeratedMapper.ToSoapEnumerated(source.RetryResults);
     var retryPhoneType = EnumeratedMapper.ToSoapEnumerated(source.RetryPhoneTypes);
     return new BroadcastConfigRetryConfig(source.MaxAttempts, source.MinutesBetweenAttempts, retry, retryPhoneType);
 }
コード例 #8
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") };
            SendText = new CfSendText(String.Empty, CfBroadcastType.Text, "broadcastSoap", toNumber, false, 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);
        }
コード例 #9
0
        public void FixtureSetup()
        {
            Client = new RestCallClient(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 ivrBroadcastConfig = new CfIvrBroadcastConfig(1, DateTime.Now, "14252163710", localTimeZoneRestriction, broadcastConfigRestryConfig,
                "<dialplan><play type=\"tts\">Congratulations! You have successfully configured a CallFire I V R.</play></dialplan>");

            var toNumber = new[] { new CfToNumber("Data", null, "14252163710") };
            SendCall = new CfSendCall(String.Empty, CfBroadcastType.Ivr, "broadcastSoap", toNumber, false, ivrBroadcastConfig);

            ActionQuery = new CfActionQuery(100, 0, 1836940001, 1092170001, new[] { CfActionState.Finished }, new[] { CfResult.La },
                false, new DateTime(2014, 1, 1), new DateTime(2014, 12, 1), "12132609784", "14252163710", string.Empty);

            QuerySoundMeta = new CfQuery();
        }
コード例 #10
0
 protected CfBroadcastConfig(long? identifier, DateTime? created, string fromNumber,
 CfLocalTimeZoneRestriction localTimeZoneRestriction, CfBroadcastConfigRetryConfig retryConfig)
 {
     Id = identifier;
     Created = created;
     FromNumber = fromNumber;
     LocalTimeZoneRestriction = localTimeZoneRestriction;
     RetryConfig = retryConfig;
 }
コード例 #11
0
 public CfVoiceBroadcastConfig(long identifier, DateTime created, string fromNumber,
 CfLocalTimeZoneRestriction localTimeZoneRestriction, CfBroadcastConfigRetryConfig retryConfig,
 CfAnsweringMachineConfig? answeringMachineConfig, object item, string liveSoundTextVoice, object item1,
 string machineSoundTextVoice, object item2, string transferSoundTextVoice, string transferDigit,
 string transferNumber, object item3, string dncSoundTextVoice, string dncDigit, int? maxActiveTransfers)
     : base(identifier, created, fromNumber, localTimeZoneRestriction, retryConfig)
 {
     AnsweringMachineConfig = answeringMachineConfig;
     Item = item;
     LiveSoundTextVoice = liveSoundTextVoice;
     Item1 = item1;
     MachineSoundTextVoice = machineSoundTextVoice;
     Item2 = item2;
     TransferSoundTextVoice = transferSoundTextVoice;
     TransferDigit = transferDigit;
     TransferNumber = transferNumber;
     Item3 = item3;
     DncSoundTextVoice = dncSoundTextVoice;
     DncDigit = dncDigit;
     MaxActiveTransfers = maxActiveTransfers;
 }
コード例 #12
0
 public CfTextBroadcastConfig(long identifier, DateTime created, string fromNumber, CfLocalTimeZoneRestriction localTimeZoneRestriction, CfBroadcastConfigRetryConfig retryConfig, string message, CfBigMessageStrategy bigMessageStrategy)
     : base(identifier, created, fromNumber, localTimeZoneRestriction, retryConfig)
 {
     Message = message;
     BigMessageStrategy = bigMessageStrategy;
 }
コード例 #13
0
 public CfIvrBroadcastConfig(long identifier, DateTime created, string fromNumber, CfLocalTimeZoneRestriction localTimeZoneRestriction, CfBroadcastConfigRetryConfig retryConfig, string dialplanXml)
     : base(identifier, created, fromNumber, localTimeZoneRestriction, retryConfig)
 {
     DialplanXml = dialplanXml;
 }
コード例 #14
0
 public CfIvrBroadcastConfig(long identifier, DateTime created, string fromNumber, CfLocalTimeZoneRestriction localTimeZoneRestriction, CfBroadcastConfigRetryConfig retryConfig, string dialplanXml)
     : base(identifier, created, fromNumber, localTimeZoneRestriction, retryConfig)
 {
     DialplanXml = dialplanXml;
 }
コード例 #15
0
 public CfVoiceBroadcastConfig(long identifier, DateTime created, string fromNumber,
                               CfLocalTimeZoneRestriction localTimeZoneRestriction, CfBroadcastConfigRetryConfig retryConfig,
                               CfAnsweringMachineConfig?answeringMachineConfig, object item, string liveSoundTextVoice, object item1,
                               string machineSoundTextVoice, object item2, string transferSoundTextVoice, string transferDigit,
                               string transferNumber, object item3, string dncSoundTextVoice, string dncDigit, int?maxActiveTransfers)
     : base(identifier, created, fromNumber, localTimeZoneRestriction, retryConfig)
 {
     AnsweringMachineConfig = answeringMachineConfig;
     Item = item;
     LiveSoundTextVoice = liveSoundTextVoice;
     Item1 = item1;
     MachineSoundTextVoice = machineSoundTextVoice;
     Item2 = item2;
     TransferSoundTextVoice = transferSoundTextVoice;
     TransferDigit          = transferDigit;
     TransferNumber         = transferNumber;
     Item3              = item3;
     DncSoundTextVoice  = dncSoundTextVoice;
     DncDigit           = dncDigit;
     MaxActiveTransfers = maxActiveTransfers;
 }
コード例 #16
0
 public CfTextBroadcastConfig(long identifier, DateTime created, string fromNumber, CfLocalTimeZoneRestriction localTimeZoneRestriction, CfBroadcastConfigRetryConfig retryConfig, string message, CfBigMessageStrategy bigMessageStrategy)
     : base(identifier, created, fromNumber, localTimeZoneRestriction, retryConfig)
 {
     Message            = message;
     BigMessageStrategy = bigMessageStrategy;
 }