Ejemplo n.º 1
0
        public void QueryGeneration_WithLinkedCohort_WHERECHIIN()
        {
            var csqb = new CohortSummaryQueryBuilder(acDataset, acCohort);

            var ex = Assert.Throws <NotSupportedException>(() => csqb.GetAdjustedAggregateBuilder(CohortSummaryAdjustment.WhereExtractionIdentifiersIn));

            Assert.AreEqual("No Query Caching Server configured", ex.Message);
        }
Ejemplo n.º 2
0
        public void QueryGeneration_BothHaveWHEREContainerAndParameters()
        {
            CreateParameters("'bob'", "'fish'");

            var global = new AnyTableSqlParameter(CatalogueRepository, cic, "DECLARE @bob AS varchar(50);");

            global.Value = "'zomber'";
            global.SaveToDatabase();

            try
            {
                ((IDeleteable)parama1).DeleteInDatabase();
                var csqb = new CohortSummaryQueryBuilder(acDataset, acCohort);

                var builder = csqb.GetAdjustedAggregateBuilder(CohortSummaryAdjustment.WhereRecordsIn);

                Assert.AreEqual(CollapseWhitespace(@"DECLARE @bob AS varchar(50);
SET @bob='zomber';
/*Agg2_Dataset*/
SELECT
Year,
count(*) AS MyCount
FROM 
MyTable
WHERE
(
	(
	/*Filter2*/
	@bob = 'fish'
	)
AND
	(
	/*Filter1*/
	@bob = 'bob'
	)
)

group by 
Year
order by 
Year"), CollapseWhitespace(builder.SQL));
            }
            finally
            {
                global.DeleteInDatabase();
                DestroyParameters();
            }
        }
Ejemplo n.º 3
0
        public void QueryGeneration_NoCohortWhereLogic()
        {
            var csqb = new CohortSummaryQueryBuilder(acDataset, acCohort);

            var builder = csqb.GetAdjustedAggregateBuilder(CohortSummaryAdjustment.WhereRecordsIn);

            Assert.AreEqual(@"/*Agg2_Dataset*/
SELECT
Year,
count(*) AS MyCount
FROM 
MyTable
group by
Year
order by
Year", builder.SQL);
        }
Ejemplo n.º 4
0
        public void QueryGeneration_Parameters_DifferentValues_WHERECHIIN()
        {
            CreateParameters("'bob'", "'fish'");

            try
            {
                var csqb = new CohortSummaryQueryBuilder(acDataset, acCohort);

                var ex = Assert.Throws <NotSupportedException>(() => csqb.GetAdjustedAggregateBuilder(CohortSummaryAdjustment.WhereExtractionIdentifiersIn));

                Assert.AreEqual("No Query Caching Server configured", ex.Message);
            }
            finally
            {
                DestroyParameters();
            }
        }