public void TestAllowingEmptyDatasets(bool allowEmptyDatasetExtractions) { Pipeline p = SetupPipeline(); TruncateDataTable(); var host = new ExtractionPipelineUseCase(_request.Configuration.Project, _request, p, DataLoadInfo.Empty); var engine = host.GetEngine(p, new ThrowImmediatelyDataLoadEventListener()); host.Source.AllowEmptyExtractions = allowEmptyDatasetExtractions; var token = new GracefulCancellationToken(); if (allowEmptyDatasetExtractions) { var dt = host.Source.GetChunk(new ThrowImmediatelyDataLoadEventListener(), token); Assert.IsNull(host.Source.GetChunk(new ThrowImmediatelyDataLoadEventListener(), token)); Assert.AreEqual(0, dt.Rows.Count); Assert.AreEqual(3, dt.Columns.Count); } else { var exception = Assert.Throws <Exception>(() => host.Source.GetChunk(new ThrowImmediatelyDataLoadEventListener(), token)); Assert.IsTrue(exception.Message.StartsWith("There is no data to load, query returned no rows, query was")); } p.DeleteInDatabase(); }