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 void FixtureSetup() { HttpClientMock = MockRepository.GenerateMock<IHttpClient>(); Client = new RestBroadcastClient(HttpClientMock); ExpectedQueryBroadcastData = new CfQueryBroadcastData(500, 0, 1); ExpectedContactBatch = new CfContactBatch(1, "contactBatch", CfBatchStatus.Active, 2, DateTime.Now, 10, 15); var contactBatchArray = new CfContactBatch[1]; contactBatchArray[0] = ExpectedContactBatch; ExpectedContactBatchQueryResult = new CfContactBatchQueryResult(10, contactBatchArray); var resource = new ResourceList(); var array = new ContactBatch[1]; array[0] = ContactBatchMapper.ToSoapContactBatch(ExpectedContactBatchQueryResult.ContactBatch[0]); resource.Resource = array; resource.TotalResults = 1; var serializer = new XmlSerializer(typeof(ResourceList)); TextWriter writer = new StringWriter(); serializer.Serialize(writer, resource); HttpClientMock .Stub(j => j.Send(Arg<string>.Is.Equal(String.Format("/broadcast/{0}/batch", ExpectedQueryBroadcastData.BroadcastId)), Arg<HttpMethod>.Is.Equal(HttpMethod.Get), Arg<object>.Is.Anything)) .Return(writer.ToString()); }
public void Test_QueryBroadcastSchedule() { BroadcastId = 1; QueryBroadcastSchedule = new CfQueryBroadcastData(100, 1, BroadcastId); var cfBroadcastScheduleQueryResult = Client.QueryBroadcastSchedule(QueryBroadcastSchedule); Assert.IsNotNull(cfBroadcastScheduleQueryResult); }
public void Test_QueryBroadcastSchedule_Properties() { BroadcastId = 1; QueryBroadcastSchedule = new CfQueryBroadcastData(100, 1, BroadcastId); var cfBroadcastScheduleQueryResult = Client.QueryBroadcastSchedule(QueryBroadcastSchedule); Assert.IsNotNull(cfBroadcastScheduleQueryResult); Assert.AreEqual(BroadcastScheduleQueryResult.TotalResults, cfBroadcastScheduleQueryResult.TotalResults); Assert.IsNotNull(cfBroadcastScheduleQueryResult.BroadcastSchedule); var broadcastSchedule = cfBroadcastScheduleQueryResult.BroadcastSchedule[0]; Assert.AreEqual(BroadcastSchedule.TimeZone, broadcastSchedule.TimeZone); Assert.AreEqual(BroadcastSchedule.DaysOfWeek, broadcastSchedule.DaysOfWeek); }
public void FixtureSetup() { HttpClientMock = MockRepository.GenerateMock<IHttpClient>(); Client = new RestBroadcastClient(HttpClientMock); BroadcastId = 1; QueryBroadcastSchedule = new CfQueryBroadcastData(100, 1, BroadcastId); CfDaysOfWeek[] daysOfWeek = { CfDaysOfWeek.Monday }; BroadcastSchedule = new CfBroadcastSchedule(1, DateTime.Now, DateTime.Now, "timeZone", DateTime.Now, DateTime.Now, daysOfWeek); var broadcastSchedule = new CfBroadcastSchedule[1]; broadcastSchedule[0] = BroadcastSchedule; BroadcastScheduleQueryResult = new CfBroadcastScheduleQueryResult(1, broadcastSchedule); var broadcastScheduleQueryResult = BroadcastScheduleQueryResultMapper.ToSoapBroadcastScheduleQueryResult(BroadcastScheduleQueryResult); GenerateMock(broadcastScheduleQueryResult); }
public void FixtureSetup() { BroadcastServiceMock = MockRepository.GenerateStub<IBroadcastServicePortTypeClient>(); Client = new SoapBroadcastClient(BroadcastServiceMock); ExpectedQueryBroadcastData = new CfQueryBroadcastData(500, 0, 1); ExpectedContactBatch = new CfContactBatch(1, "contactBatch", CfBatchStatus.Active, 2, DateTime.Now, 10, 15); var contactBatchArray = new CfContactBatch[1]; contactBatchArray[0] = ExpectedContactBatch; ExpectedContactBatchQueryResult = new CfContactBatchQueryResult(10, contactBatchArray); BroadcastServiceMock .Stub(b => b.QueryContactBatches( Arg<QueryContactBatches>.Matches(x => x.MaxResults == ExpectedQueryBroadcastData.MaxResults && x.FirstResult == ExpectedQueryBroadcastData.FirstResult && x.BroadcastId == ExpectedQueryBroadcastData.BroadcastId))) .Return(ContactBatchQueryResultMapper.ToSoapContactBatchQueryResult(ExpectedContactBatchQueryResult)); }
public void FixtureSetup() { BroadcastServiceMock = MockRepository.GenerateStub<IBroadcastServicePortTypeClient>(); Client = new SoapBroadcastClient(BroadcastServiceMock); BroadcastId = 1; QueryBroadcastSchedule = new CfQueryBroadcastData(100, 1, BroadcastId); CfDaysOfWeek[] daysOfWeek = {CfDaysOfWeek.Monday}; BroadcastSchedule = new CfBroadcastSchedule(1, DateTime.Now, DateTime.Now, "timeZone", DateTime.Now, DateTime.Now, daysOfWeek); var broadcastSchedule = new CfBroadcastSchedule[1]; broadcastSchedule[0] = BroadcastSchedule; BroadcastScheduleQueryResult = new CfBroadcastScheduleQueryResult(1, broadcastSchedule); var broadcastScheduleQueryResult = BroadcastScheduleQueryResultMapper.ToSoapBroadcastScheduleQueryResult(BroadcastScheduleQueryResult); GenerateMock(BroadcastId, broadcastScheduleQueryResult); BroadcastId = 2; BroadcastScheduleQueryResult.BroadcastSchedule = null; broadcastScheduleQueryResult = BroadcastScheduleQueryResultMapper.ToSoapBroadcastScheduleQueryResult(BroadcastScheduleQueryResult); GenerateMock(BroadcastId, broadcastScheduleQueryResult); }
public CfBroadcastScheduleQueryResult QueryBroadcastSchedule(CfQueryBroadcastData queryBroadcastData) { return BroadcastScheduleQueryResultMapper.FromSoapBroadcastScheduleQueryResult( BroadcastService.QueryBroadcastSchedule( new QueryBroadcastSchedules(queryBroadcastData))); }
public CfContactBatchQueryResult QueryContactBatches(CfQueryBroadcastData queryBroadcastData) { return ContactBatchQueryResultMapper.FromSoapContactBatchQueryResult( BroadcastService.QueryContactBatches(new QueryContactBatches(queryBroadcastData))); }
public QueryBroadcastSchedules(CfQueryBroadcastData source) { MaxResults = source.MaxResults; FirstResult = source.FirstResult; BroadcastId = source.BroadcastId; }