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 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", }, }; }
public CfSendText(string requestId, CfBroadcastType type, string broadcastName, CfToNumber[] toNumber, bool scrubBroadcastDuplicates, CfTextBroadcastConfig textBroadcastConfig, long?broadcastId, Boolean useDefaultBroadcast) { RequestId = requestId; Type = type; BroadcastName = broadcastName; ToNumber = toNumber; ScrubBroadcastDuplicates = scrubBroadcastDuplicates; TextBroadcastConfig = textBroadcastConfig; BroadcastId = broadcastId; UseDefaultBroadcast = useDefaultBroadcast; }
public TextBroadcastConfig(CfTextBroadcastConfig source) { if (source.Id.HasValue) { id = source.Id.Value; idSpecified = true; } if (source.Created.HasValue) { Created = source.Created.Value; CreatedSpecified = true; } FromNumber = source.FromNumber; LocalTimeZoneRestriction = LocalTimeZoneRestrictionMapper.ToSoapLocalTimeZoneRestriction(source.LocalTimeZoneRestriction); RetryConfig = BroadcastConfigRetryConfigMapper.ToBroadcastConfigRetryConfig(source.RetryConfig); Message = source.Message; BigMessageStrategy = EnumeratedMapper.ToSoapEnumerated <BigMessageStrategy>(source.BigMessageStrategy.ToString()); }
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); }
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); }
internal static TextBroadcastConfig ToSoapTextBroadcastConfig(CfTextBroadcastConfig source) { return(source == null ? null : new TextBroadcastConfig(source)); }