public void CreateLookup_linkWithOtherTable(bool memoryRepo) { var repo = memoryRepo? (ICatalogueRepository) new MemoryCatalogueRepository():CatalogueRepository; TableInfo parent = null; TableInfo parent2 = null; ColumnInfo child = null; ColumnInfo child2 = null; ColumnInfo child3 = null; try { parent = new TableInfo(repo, "unit_test_CreateLookup"); parent2 = new TableInfo(repo, "unit_test_CreateLookupOther"); child = new ColumnInfo(repo, "unit_test_CreateLookup", "int", parent); //lookup desc child2 = new ColumnInfo(repo, "unit_test_CreateLookup", "int", parent2); //fk in data table child3 = new ColumnInfo(repo, "unit_test_CreateLookup", "int", parent); //pk in lookup new Lookup(repo, child, child2, child3, ExtractionJoinType.Left, null); Assert.AreEqual(child.GetAllLookupForColumnInfoWhereItIsA(LookupType.Description).Length, 1); Assert.AreEqual(child2.GetAllLookupForColumnInfoWhereItIsA(LookupType.Description).Length, 0); Assert.AreEqual(child.GetAllLookupForColumnInfoWhereItIsA(LookupType.AnyKey).Length, 0); Assert.AreEqual(child2.GetAllLookupForColumnInfoWhereItIsA(LookupType.AnyKey).Length, 1); Assert.AreEqual(child3.GetAllLookupForColumnInfoWhereItIsA(LookupType.AnyKey).Length, 1); Assert.IsTrue(parent.IsLookupTable()); Assert.IsFalse(parent2.IsLookupTable()); } finally { //cleanup try { child.DeleteInDatabase(); }catch (Exception) { } try { child2.DeleteInDatabase(); }catch (Exception) { } try { child3.DeleteInDatabase(); }catch (Exception) { } try { parent.DeleteInDatabase(); }catch (Exception) { } try { parent2.DeleteInDatabase(); }catch (Exception) { } } }