public void FixtureSetup()
        {
            HttpClientMock = MockRepository.GenerateMock<IHttpClient>();
            Client = new RestBroadcastClient(HttpClientMock);

            BroadcastId = 1;
            GetBroadcastStats = new CfGetBroadcastStats(BroadcastId, DateTime.Now, DateTime.Now);
            ExpectedUsageStats = new BroadcastStatsUsageStats(5, 5, 2, 10, 2);

            var resultStat = new BroadcastStatsResultStat[1];
            ExpectedResultStat = new BroadcastStatsResultStat("result", 2, 3);
            resultStat[0] = ExpectedResultStat;

            ExpectedActionsStatistics = new BroadcastStatsActionStatistics(2, 0, 10);

            var expectedBroadcastStats = new BroadcastStats(ExpectedUsageStats, resultStat, ExpectedActionsStatistics);

            var resource = new Resource { Resources = expectedBroadcastStats };
            var serializer = new XmlSerializer(typeof(Resource));
            TextWriter writer = new StringWriter();
            serializer.Serialize(writer, resource);

            HttpClientMock
                .Stub(j => j.Send(Arg<string>.Is.Equal(String.Format("/broadcast/{0}/stats", BroadcastId)),
                    Arg<HttpMethod>.Is.Equal(HttpMethod.Get),
                    Arg<object>.Is.Anything))
                .Return(writer.ToString());
        }
        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()
        {
            BroadcastServiceMock = MockRepository.GenerateStub<IBroadcastServicePortTypeClient>();
            Client = new SoapBroadcastClient(BroadcastServiceMock);

            BroadcastId = 1;
            GetBroadcastStats = new CfGetBroadcastStats(BroadcastId, DateTime.Now, DateTime.Now);
            ExpectedUsageStats = new BroadcastStatsUsageStats(5, 5, 2, 10, 2);

            var resultStat = new BroadcastStatsResultStat[1];
            ExpectedResultStat = new BroadcastStatsResultStat("result", 2, 3);
            resultStat[0] = ExpectedResultStat;

            ExpectedActionsStatistics = new BroadcastStatsActionStatistics(2, 0, 10);

            var expectedBroadcastStats = new BroadcastStats(ExpectedUsageStats, resultStat, ExpectedActionsStatistics);
            BroadcastServiceMock
                .Stub(b => b.GetBroadcastStats(Arg<GetBroadcastStats>.Matches(x => x.Id == BroadcastId)))
                .Return(expectedBroadcastStats);
        }
 public CfBroadcastStats GetBroadcastStats(CfGetBroadcastStats getBroadcastStats)
 {
     return BroadcastStatsMapper.FromSoapBroadcastStats(
         BroadcastService.GetBroadcastStats(new GetBroadcastStats(getBroadcastStats)));
 }