示例#1
0
        public void ControlBroadcast(CfControlBroadcast cfControlBroadcast)
        {
            var controlBroadcast = new ControlBroadcast(cfControlBroadcast);

            BaseRequest <string>(HttpMethod.Put, controlBroadcast,
                                 new CallfireRestRoute <Broadcast>(controlBroadcast.Id, null, BroadcastRestRouteObjects.Control));
        }
        public void Test_ControlBroadcastInvalidID()
        {
            var controlBroadcast = new CfControlBroadcast
            {
                Command = CfBroadcastCommand.Start
            };

            AssertClientException <WebException, FaultException <ServiceFaultInfo> >(() => Client.ControlBroadcast(controlBroadcast));
        }
        public void FixtureSetup()
        {
            BroadcastServiceMock = MockRepository.GenerateStub <IBroadcastServicePortTypeClient>();
            Client = new SoapBroadcastClient(BroadcastServiceMock);
            ExpectedControlBroadcast = new CfControlBroadcast(1, "123", CfBroadcastCommand.Start, 5);

            BroadcastServiceMock
            .Stub(b => b.ControlBroadcast(Arg <ControlBroadcast> .Matches(x => x.Id == ExpectedControlBroadcast.Id &&
                                                                          x.RequestId == ExpectedControlBroadcast.RequestId &&
                                                                          x.MaxActive == ExpectedControlBroadcast.MaxActive &&
                                                                          x.Command == BroadcastCommand.START)));
        }
        public void Test_ControlBroadcastStart()
        {
            var controlBroadcast = new CfControlBroadcast
            {
                Command = CfBroadcastCommand.Start
            };
            var broadcastRequest = new CfBroadcastRequest(string.Empty, ExpectedBroadcastDefault);

            controlBroadcast.Id = Client.CreateBroadcast(broadcastRequest);

            AssertClientException <WebException, FaultException <ServiceFaultInfo> >(() => Client.ControlBroadcast(controlBroadcast));
        }
示例#5
0
        public void FixtureSetup()
        {
            HttpClientMock = MockRepository.GenerateMock <IHttpClient>();
            Client         = new RestBroadcastClient(HttpClientMock);

            ExpectedControlBroadcast = new CfControlBroadcast(1, "123", CfBroadcastCommand.Start, 5);

            HttpClientMock
            .Stub(j => j.Send(Arg <string> .Is.Equal("/broadcast"),
                              Arg <HttpMethod> .Is.Equal(HttpMethod.Put),
                              Arg <ControlBroadcast> .Matches(x => x.Id == ExpectedControlBroadcast.Id &&
                                                              x.RequestId == ExpectedControlBroadcast.RequestId &&
                                                              x.Command == BroadcastCommand.START &&
                                                              x.MaxActive == ExpectedControlBroadcast.MaxActive)));
        }
 public ControlBroadcast(CfControlBroadcast cfControlBroadcast)
     : base(cfControlBroadcast.Id)
 {
     RequestId = cfControlBroadcast.RequestId;
     if (cfControlBroadcast.Command.HasValue)
     {
         Command          = EnumeratedMapper.ToSoapEnumerated <BroadcastCommand>(cfControlBroadcast.Command.ToString());
         CommandSpecified = true;
     }
     if (cfControlBroadcast.MaxActive.HasValue)
     {
         MaxActive          = cfControlBroadcast.MaxActive.Value;
         MaxActiveSpecified = true;
     }
 }
        public void Test_ControlBroadcastArchive()
        {
            var controlBroadcast = new CfControlBroadcast
            {
                Command = CfBroadcastCommand.Archive
            };
            var broadcastRequest = new CfBroadcastRequest(string.Empty, ExpectedBroadcastDefault);

            controlBroadcast.Id = Client.CreateBroadcast(broadcastRequest);

            Client.ControlBroadcast(controlBroadcast);
            var broadcast = Client.GetBroadcast(controlBroadcast.Id);

            Assert.AreEqual(CfBroadcastStatus.Archived, broadcast.Status);
        }
示例#8
0
        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 Test_ControlBroadcast()
        {
            var controlBroadcast = new CfControlBroadcast(ExpectedControlBroadcast.Id, ExpectedControlBroadcast.RequestId, CfBroadcastCommand.Start, ExpectedControlBroadcast.MaxActive);

            Client.ControlBroadcast(controlBroadcast);
        }
示例#10
0
 public void ControlBroadcast(CfControlBroadcast controlBroadcast)
 {
     BroadcastService.ControlBroadcast(new ControlBroadcast(controlBroadcast));
 }