public void Test_CatalogueItems_ExtractionInformationPrimaryKey_IsRespected() { var request = SetupExtractDatasetCommand("ExtractionInformationPrimaryKey_IsRespected", new[] { "DateOfBirth" }); var source = new ExecutePkSynthesizerDatasetExtractionSource(); source.PreInitialize(request, new ThrowImmediatelyDataLoadEventListener()); var chunk = source.GetChunk(new ThrowImmediatelyDataLoadEventListener(), new GracefulCancellationToken()); Assert.That(chunk.PrimaryKey, Is.Not.Null); Assert.That(chunk.Columns.Cast <DataColumn>().ToList(), Has.Count.EqualTo(_columnInfos.Count())); // NO new column added Assert.That(chunk.PrimaryKey, Has.Length.EqualTo(1)); Assert.That(chunk.PrimaryKey.First().ColumnName, Is.EqualTo("DateOfBirth")); }
public void Test_CatalogueItems_NonExtractedPrimaryKey_AreRespected() { var request = SetupExtractDatasetCommand("NonExtractedPrimaryKey_AreRespected", new string[] { }, pkColumnInfos: new [] { "DateOfBirth" }); var source = new ExecutePkSynthesizerDatasetExtractionSource(); source.PreInitialize(request, new ThrowImmediatelyDataLoadEventListener()); var chunk = source.GetChunk(new ThrowImmediatelyDataLoadEventListener(), new GracefulCancellationToken()); Assert.That(chunk.PrimaryKey, Is.Not.Null); Assert.That(chunk.Columns.Cast <DataColumn>().ToList(), Has.Count.EqualTo(_columnInfos.Count() + 1)); // synth PK is added Assert.That(chunk.PrimaryKey, Has.Length.EqualTo(1)); Assert.That(chunk.PrimaryKey.First().ColumnName, Is.EqualTo("SynthesizedPk")); var firstvalue = chunk.Rows[0]["SynthesizedPk"].ToString(); Assert.IsTrue(reghex.IsMatch(firstvalue)); }
public void Test_CatalogueItems_NonExtractedPrimaryKey_LookupsOnly_IsRespected() { var request = SetupExtractDatasetCommand("LookupsOnly_IsRespected", new string[] { }, pkColumnInfos: new[] { "DateOfBirth" }, withLookup: true); var source = new ExecutePkSynthesizerDatasetExtractionSource(); source.PreInitialize(request, new ThrowImmediatelyDataLoadEventListener()); var chunk = source.GetChunk(new ThrowImmediatelyDataLoadEventListener(), new GracefulCancellationToken()); Assert.That(chunk.PrimaryKey, Is.Not.Null); Assert.That(chunk.Columns.Cast <DataColumn>().ToList(), Has.Count.EqualTo(_columnInfos.Count() + 2)); // the "desc" column is added to the existing ones + the SynthPk Assert.That(chunk.PrimaryKey, Has.Length.EqualTo(1)); Assert.That(chunk.PrimaryKey.First().ColumnName, Is.EqualTo("SynthesizedPk")); var firstvalue = chunk.Rows[0]["SynthesizedPk"].ToString(); Assert.IsTrue(reghex.IsMatch(firstvalue)); Database.ExpectTable("SimpleLookup").Drop(); }