コード例 #1
0
        public CfContactBatch GetContactBatch(long id)
        {
            var resource = BaseRequest <Resource>(HttpMethod.Get, null,
                                                  new CallfireRestRoute <Broadcast>(id, BroadcastRestRouteObjects.Batch, null));

            return(ContactBatchMapper.FromSoapContactBatch(resource.Resources as ContactBatch));
        }
コード例 #2
0
        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());
        }
コード例 #3
0
        public CfContactBatchQueryResult QueryContactBatches(CfQueryBroadcastData cfQueryBroadcastData)
        {
            var resourceList = BaseRequest <ResourceList>(HttpMethod.Get, new QueryContactBatches(cfQueryBroadcastData),
                                                          new CallfireRestRoute <Broadcast>(cfQueryBroadcastData.BroadcastId, null,
                                                                                            BroadcastRestRouteObjects.Batch));

            var contactBatch = resourceList.Resource == null ? null
               : resourceList.Resource.Select(r => ContactBatchMapper.FromSoapContactBatch((ContactBatch)r)).ToArray();

            return(new CfContactBatchQueryResult(resourceList.TotalResults, contactBatch));
        }
コード例 #4
0
        public void FixtureSetup()
        {
            BroadcastServiceMock = MockRepository.GenerateStub <IBroadcastServicePortTypeClient>();
            Client = new SoapBroadcastClient(BroadcastServiceMock);

            ContactBatchId       = 1;
            ExpectedContactBatch = new CfContactBatch(ContactBatchId, "contactBatch", CfBatchStatus.Active, 5, DateTime.Now, 200, 10);

            var contactBatch = ContactBatchMapper.ToSoapContactBatch(ExpectedContactBatch);

            BroadcastServiceMock
            .Stub(b => b.GetContactBatch(Arg <IdRequest> .Matches(x => x.Id == ContactBatchId)))
            .Return(contactBatch);
        }
コード例 #5
0
        public void FixtureSetup()
        {
            HttpClientMock = MockRepository.GenerateMock <IHttpClient>();
            Client         = new RestBroadcastClient(HttpClientMock);

            ContactBatchId       = 1;
            ExpectedContactBatch = new CfContactBatch(ContactBatchId, "contactBatch", CfBatchStatus.Active, 5, DateTime.Now, 200, 10);

            var contactBatch = ContactBatchMapper.ToSoapContactBatch(ExpectedContactBatch);

            var resource = new Resource {
                Resources = contactBatch
            };
            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/batch/{0}", ContactBatchId)),
                              Arg <HttpMethod> .Is.Equal(HttpMethod.Get),
                              Arg <object> .Is.Null))
            .Return(writer.ToString());
        }
コード例 #6
0
 public CfContactBatch GetContactBatch(long id)
 {
     return(ContactBatchMapper.FromSoapContactBatch(BroadcastService.GetContactBatch(new IdRequest(id))));
 }