public void FixtureSetup()
        {
            BroadcastServiceMock = MockRepository.GenerateStub <IBroadcastServicePortTypeClient>();
            Client = new SoapBroadcastClient(BroadcastServiceMock);

            CfDaysOfWeek[] daysOfWeek = { CfDaysOfWeek.Monday };
            BroadcastSchedule       = new CfBroadcastSchedule(BroadcastScheduleId, DateTime.Now, DateTime.Now, "timeZone", DateTime.Now, DateTime.Now, daysOfWeek);
            CreateBroadcastSchedule = new CfCreateBroadcastSchedule("requestId", BroadcastScheduleId, BroadcastSchedule);

            BroadcastServiceMock
            .Stub(
                b =>
                b.CreateBroadcastSchedule(
                    Arg <CreateBroadcastSchedule> .Matches(
                        x => x.RequestId == CreateBroadcastSchedule.RequestId &&
                        x.BroadcastId == CreateBroadcastSchedule.BroadcastId &&
                        x.BroadcastSchedule.id == BroadcastSchedule.Id &&
                        x.BroadcastSchedule.BeginDate == BroadcastSchedule.BeginDate &&
                        x.BroadcastSchedule.EndDate == BroadcastSchedule.EndDate &&
                        x.BroadcastSchedule.TimeZone == BroadcastSchedule.TimeZone &&
                        x.BroadcastSchedule.StartTimeOfDay == BroadcastSchedule.StartTimeOfDay &&
                        x.BroadcastSchedule.StopTimeOfDay == BroadcastSchedule.StopTimeOfDay &&
                        x.BroadcastSchedule.DaysOfWeek == BroadcastSchedule.DaysOfWeek.ToString().ToUpper())))
            .Return(BroadcastScheduleId);
        }
        public void FixtureSetup()
        {
            HttpClientMock = MockRepository.GenerateMock <IHttpClient>();
            Client         = new RestBroadcastClient(HttpClientMock);

            BroadcastScheduleId = 4889;
            CfDaysOfWeek[] daysOfWeek = { CfDaysOfWeek.Monday };
            BroadcastSchedule       = new CfBroadcastSchedule(BroadcastScheduleId, DateTime.Now, DateTime.Now, "timeZone", DateTime.Now, DateTime.Now, daysOfWeek);
            CreateBroadcastSchedule = new CfCreateBroadcastSchedule("requestId", BroadcastScheduleId, BroadcastSchedule);

            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}/schedule</r:Location>" +
                "</r:ResourceReference>", BroadcastScheduleId);

            HttpClientMock.Stub(
                j =>
                j.Send(Arg <string> .Is.Equal(string.Format("/broadcast/{0}/schedule", BroadcastScheduleId)),
                       Arg <HttpMethod> .Is.Equal(HttpMethod.Post),
                       Arg <CreateBroadcastSchedule> .Matches(x => x.RequestId == CreateBroadcastSchedule.RequestId &&
                                                              x.BroadcastId == CreateBroadcastSchedule.BroadcastId &&
                                                              x.BroadcastSchedule.id == BroadcastSchedule.Id &&
                                                              x.BroadcastSchedule.BeginDate == BroadcastSchedule.BeginDate &&
                                                              x.BroadcastSchedule.EndDate == BroadcastSchedule.EndDate &&
                                                              x.BroadcastSchedule.TimeZone == BroadcastSchedule.TimeZone &&
                                                              x.BroadcastSchedule.StartTimeOfDay == BroadcastSchedule.StartTimeOfDay &&
                                                              x.BroadcastSchedule.StopTimeOfDay == BroadcastSchedule.StopTimeOfDay)))
            .Return(response);
        }
예제 #3
0
 public long CreateBroadcastSchedule(CfCreateBroadcastSchedule createBroadcastSchedule)
 {
     return
         (BroadcastService.CreateBroadcastSchedule(new CreateBroadcastSchedule(createBroadcastSchedule.RequestId,
                                                                               createBroadcastSchedule.BroadcastId,
                                                                               BroadcastScheduleMapper.ToSoapBroadcastSchedule(createBroadcastSchedule.BroadcastSchedule))));
 }
예제 #4
0
        public long CreateBroadcastSchedule(CfCreateBroadcastSchedule cfCreateBroadcastSchedule)
        {
            var createBroadcastSchedule = new CreateBroadcastSchedule(cfCreateBroadcastSchedule.RequestId,
                                                                      cfCreateBroadcastSchedule.BroadcastId,
                                                                      BroadcastScheduleMapper.ToSoapBroadcastSchedule(cfCreateBroadcastSchedule.BroadcastSchedule));
            var resource = BaseRequest <ResourceReference>(HttpMethod.Post, createBroadcastSchedule,
                                                           new CallfireRestRoute <Broadcast>(createBroadcastSchedule.BroadcastId, null, BroadcastRestRouteObjects.Schedule));

            return(resource.Id);
        }
        public void Test_CreateBroadcastScheduleMandatory()
        {
            var createBroadcastSchedule = new CfCreateBroadcastSchedule
            {
                BroadcastId       = 1931347001,
                BroadcastSchedule = new CfBroadcastSchedule
                {
                    StartTimeOfDay = new DateTime(2014, 01, 01, 08, 00, 00),
                    StopTimeOfDay  = new DateTime(2014, 01, 01, 20, 00, 00),
                    TimeZone       = "America/Edmonton"
                }
            };
            var id = Client.CreateBroadcastSchedule(createBroadcastSchedule);

            Assert.NotNull(id);
        }
        public void Test_DeleteBroadcastScheduleValidID()
        {
            var createBroadcastSchedule = new CfCreateBroadcastSchedule
            {
                BroadcastId       = 1934511001,
                BroadcastSchedule = new CfBroadcastSchedule
                {
                    StartTimeOfDay = new DateTime(2014, 01, 01, 08, 00, 00),
                    StopTimeOfDay  = new DateTime(2014, 01, 01, 20, 00, 00),
                    TimeZone       = "America/Edmonton"
                }
            };
            var id = Client.CreateBroadcastSchedule(createBroadcastSchedule);

            Client.DeleteBroadcastSchedule(id);
        }
        public void Test_CreateBroadcastScheduleComplete()
        {
            var createBroadcastSchedule = new CfCreateBroadcastSchedule
            {
                BroadcastId       = 1931347001,
                BroadcastSchedule = new CfBroadcastSchedule
                {
                    BeginDate      = new DateTime(2014, 06, 18, 00, 00, 00),
                    EndDate        = new DateTime(2014, 07, 18, 00, 00, 00),
                    StartTimeOfDay = new DateTime(2014, 01, 01, 13, 00, 00),
                    StopTimeOfDay  = new DateTime(2014, 01, 01, 20, 00, 00),
                    TimeZone       = "America/Edmonton",
                    DaysOfWeek     = new [] { CfDaysOfWeek.Monday, CfDaysOfWeek.Sunday }
                }
            };
            var id = Client.CreateBroadcastSchedule(createBroadcastSchedule);

            Assert.NotNull(id);
        }