public async Task <Guid> CreateUnsavedQueryAsync(PatientCohort cohort, IUserContext user) { var nonce = NonceOrThrowIfNull(user); using (var cn = new SqlConnection(dbOptions.ConnectionString)) { await cn.OpenAsync(); var queryId = await cn.ExecuteScalarAsync <Guid>( queryCreateUnsaved, new { user = user.UUID, nonce }, commandType : CommandType.StoredProcedure, commandTimeout : dbOptions.DefaultTimeout ); if (cohort.Any() && cohort.Count <= cohortOptions.RowLimit) { var cohortTable = new PatientCohortTable(queryId, cohort.SeasonedPatients(cohortOptions.ExportLimit, queryId)); using (var bc = new SqlBulkCopy(cn)) { bc.DestinationTableName = PatientCohortTable.Table; await bc.WriteToServerAsync(cohortTable.Rows); } } return(queryId); } }
public void Any_Returns_False_If_There_Are_No_PatientIds() { Assert.False(emptyPatCohort.Any()); }
public void Any_Returns_True_If_There_Are_PatientIds() { Assert.True(patCohort.Any()); }