public void FixtureSetup() { HttpClientMock = MockRepository.GenerateMock <IHttpClient>(); Client = new RestBroadcastClient(HttpClientMock); BroadcastId = 28936; const long id = 188717001; object[] contactList = { id }; ExpectedCreateContactBatch = new CfCreateContactBatch("1", BroadcastId, "name", contactList, false); 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}/batch</r:Location>" + "</r:ResourceReference>", BroadcastId); HttpClientMock .Stub(j => j.Send(Arg <string> .Is.Equal(String.Format("/broadcast/{0}/batch", BroadcastId)), Arg <HttpMethod> .Is.Equal(HttpMethod.Post), Arg <CreateContactBatch> .Matches(x => x.RequestId == ExpectedCreateContactBatch.RequestId && x.BroadcastId == ExpectedCreateContactBatch.BroadcastId && x.Name == ExpectedCreateContactBatch.Name && x.ScrubBroadcastDuplicates == ExpectedCreateContactBatch.ScrubBroadcastDuplicates))) .Return(response); }
public long CreateContactBatch(CfCreateContactBatch cfCreateContactBatch) { var createContactBatch = new CreateContactBatch(cfCreateContactBatch.RequestId, cfCreateContactBatch.BroadcastId, cfCreateContactBatch.Name, cfCreateContactBatch.Items, cfCreateContactBatch.ScrubBroadcastDuplicates); var resource = BaseRequest <ResourceReference>(HttpMethod.Post, createContactBatch, new CallfireRestRoute <Broadcast>(createContactBatch.BroadcastId, null, BroadcastRestRouteObjects.Batch)); return(resource.Id); }
public void Test_CreateContactBatchInComplete() { var createContactBatch = new CfCreateContactBatch { Name = "Test Contact Batch", ScrubBroadcastDuplicates = false }; AssertClientException <WebException, FaultException>(() => Client.CreateContactBatch(createContactBatch)); }
public void Test_CreateContactBatchBroadcastId() { var broadcastRequest = new CfBroadcastRequest(string.Empty, ExpectedBroadcastDefault); var id = Client.CreateBroadcast(broadcastRequest); object[] contactListId = { Convert.ToInt64(192949001) }; var createContactBatch = new CfCreateContactBatch { BroadcastId = id, Name = "Test Contact Batch", Items = contactListId, ScrubBroadcastDuplicates = false }; var idContactBatch = Client.CreateContactBatch(createContactBatch); Assert.NotNull(idContactBatch); }
public void FixtureSetup() { BroadcastServiceMock = MockRepository.GenerateStub <IBroadcastServicePortTypeClient>(); Client = new SoapBroadcastClient(BroadcastServiceMock); BroadcastId = 2; const long id = 188717001; object[] contactList = { id }; ExpectedCreateContactBatch = new CfCreateContactBatch("1", BroadcastId, "name", contactList, false); BroadcastServiceMock .Stub(b => b.CreateContactBatch(Arg <CreateContactBatch> .Matches(x => x.RequestId == ExpectedCreateContactBatch.RequestId && x.BroadcastId == ExpectedCreateContactBatch.BroadcastId && x.Name == ExpectedCreateContactBatch.Name && x.ScrubBroadcastDuplicates == ExpectedCreateContactBatch.ScrubBroadcastDuplicates))) .Return(BroadcastId); }
public void Test_CreateContactBatchComplete() { var broadcastRequest = new CfBroadcastRequest(string.Empty, ExpectedBroadcastDefault); var id = Client.CreateBroadcast(broadcastRequest); object[] toNumberList = { new CfToNumber { Value = VerifyFromNumber, ClientData = "Client1" }, new CfToNumber { Value = VerifyShortCode, ClientData = "Client2" } }; var createContactBatch = new CfCreateContactBatch { BroadcastId = id, Name = "Test Contact Batch", Items = toNumberList, ScrubBroadcastDuplicates = true }; var idContactBatch = Client.CreateContactBatch(createContactBatch); Assert.NotNull(idContactBatch); }
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); }
public long CreateContactBatch(CfCreateContactBatch createContactBatch) { return(BroadcastService.CreateContactBatch(new CreateContactBatch(createContactBatch.RequestId, createContactBatch.BroadcastId, createContactBatch.Name, createContactBatch.Items, createContactBatch.ScrubBroadcastDuplicates))); }