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()); }
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); }
public ContactBatch(CfContactBatch source) { Name = source.Name; Status = EnumeratedMapper.ToSoapEnumerated<BatchStatus>(source.Status.ToString()); BroadcastId = source.BroadcastId; Created = source.Created; if (source.Size.HasValue) { Size = source.Size.Value; SizeSpecified = true; } if (source.Remaining.HasValue) { Remaining = source.Remaining.Value; RemainingSpecified = true; } id = source.Id; }
public void FixtureSetup() { BroadcastServiceMock = MockRepository.GenerateStub<IBroadcastServicePortTypeClient>(); Client = new SoapBroadcastClient(BroadcastServiceMock); 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); BroadcastServiceMock .Stub(b => b.QueryContactBatches( Arg<QueryContactBatches>.Matches(x => x.MaxResults == ExpectedQueryBroadcastData.MaxResults && x.FirstResult == ExpectedQueryBroadcastData.FirstResult && x.BroadcastId == ExpectedQueryBroadcastData.BroadcastId))) .Return(ContactBatchQueryResultMapper.ToSoapContactBatchQueryResult(ExpectedContactBatchQueryResult)); }
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()); }
internal static ContactBatch ToSoapContactBatch(CfContactBatch source) { return source == null ? null : new ContactBatch(source); }
public CfContactBatchQueryResult(long totalResults, CfContactBatch[] contactBatch) : base(totalResults) { ContactBatch = contactBatch; }