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()); }
internal static CfContactBatch FromSoapContactBatch(ContactBatch source) { if (source == null) { return null; } return new CfContactBatch(source.id, source.Name, EnumeratedMapper.EnumFromSoapEnumerated<CfBatchStatus>(source.Status.ToString()), source.BroadcastId, source.Created, source.Size, source.Remaining); }