public void ReadBatchDataFromStore() { var orgService = ConnectionHelper.GetOrganizationalServiceSource(); var entRepo = new EntityRepository(orgService, retryExecutor); string folderPath = new FileInfo(Assembly.GetExecutingAssembly().Location).DirectoryName; string fetchXMLFolderPath = Path.Combine(folderPath, "TestData\\FetchXmlFolder"); CrmExporterConfig config = new CrmExporterConfig() { FetchXMLFolderPath = fetchXMLFolderPath }; DataCrmStoreReader crmStore = new DataCrmStoreReader(new ConsoleLogger(), entRepo, config); List <EntityWrapper> results = new List <EntityWrapper>(); List <EntityWrapper> batch = crmStore.ReadBatchDataFromStore(); while (batch.Count > 0) { results.AddRange(batch); batch = crmStore.ReadBatchDataFromStore(); } Assert.IsTrue(results.Count > 0); }
public void ReadBatchDataFromStore() { var entityWrapperList = new List <EntityWrapper> { new EntityWrapper(new Entity("contact", Guid.NewGuid())) }; MockEntityRepo.Setup(a => a.GetEntitesByFetchXML(It.IsAny <string>(), It.IsAny <int>(), It.IsAny <int>(), ref It.Ref <string> .IsAny)) .Returns(entityWrapperList); systemUnderTest = new DataCrmStoreReader(MockLogger.Object, MockEntityRepo.Object, pageSize, batchSize, topCount, oneEntityPerBatch, FetchXMlQueries, EmptyFieldsToObfuscate); var actual = systemUnderTest.ReadBatchDataFromStore(); actual.Should().NotBeNull(); MockLogger.Verify(a => a.LogVerbose(It.IsAny <string>())); }