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);

            var queryBroadcast = new Broadcast[1];
            BroadcastId = 1;
            BroadcastName = "broadcast";
            BroadcastLastModified = DateTime.Now;
            queryBroadcast[0] = new Broadcast(BroadcastId, BroadcastName, BroadcastStatus.RUNNING, BroadcastLastModified, BroadcastType.IVR, null);

            CfBroadcastType[] broadcastType = { CfBroadcastType.Ivr};
            ExpectedQueryBroadcast = new CfQueryBroadcasts(5, 0, broadcastType, true, "labelName");

            var cfBroadcastQueryResult = new BroadcastQueryResult(1, queryBroadcast);

            var resource = new ResourceList();
            var array = new Broadcast[1];
            array[0] = cfBroadcastQueryResult.Broadcast[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")),
                    Arg<HttpMethod>.Is.Equal(HttpMethod.Get),
                    Arg<object>.Is.Anything))
                .Return(writer.ToString());
        }
 public void Test_QueryBroadcast()
 {
     CfBroadcastType[] broadcastType = { CfBroadcastType.Ivr };
     var cfQueryBroadcasts = new CfQueryBroadcasts(ExpectedQueryBroadcast.MaxResults, ExpectedQueryBroadcast.FirstResult, broadcastType, true, ExpectedQueryBroadcast.LabelName);
     
     var cfBroadcastQueryResult = Client.QueryBroadcasts(cfQueryBroadcasts);
     Assert.IsNotNull(cfBroadcastQueryResult);
 }
 public QueryBroadcasts(CfQueryBroadcasts source)
 {
     MaxResults = source.MaxResults;
     FirstResult = source.FirstResult;
     Type = EnumeratedMapper.ToSoapEnumerated(source.Type);
     if (source.Running.HasValue)
     {
         Running = source.Running.Value;
         RunningSpecified = true;
     }
     LabelName = source.LabelName;
 }
        public void Test_QueryBroadcast_properties()
        {
            CfBroadcastType[] broadcastType = { CfBroadcastType.Ivr };
            var cfQueryBroadcasts = new CfQueryBroadcasts(ExpectedQueryBroadcast.MaxResults, ExpectedQueryBroadcast.FirstResult, broadcastType, true, ExpectedQueryBroadcast.LabelName);

            var cfBroadcastQueryResult = Client.QueryBroadcasts(cfQueryBroadcasts);
            Assert.IsNotNull(cfBroadcastQueryResult);

            var broadcast = cfBroadcastQueryResult.Broadcast[0];
            Assert.IsNotNull(broadcast);
            Assert.AreEqual(BroadcastName, broadcast.Name);
            Assert.IsNull(broadcast.Item);
        }
 public CfBroadcastQueryResult QueryBroadcasts(CfQueryBroadcasts queryBroadcasts)
 {
     return BroadcastQueryResultMapper.FromSoapBroadcastQueryResult(
         BroadcastService.QueryBroadcasts(new QueryBroadcasts(queryBroadcasts)));
 }