public void ChildCollectionsFunctionCorrectly() { SQLiteDatabase db = new SQLiteDatabase(nameof(XrefListTest)); db.TryEnsureSchema <TestTable>(); TestTable.LoadAll(db).Delete(); TestFkTable.LoadAll(db).Delete(); TestTable testTable = new TestTable { Name = "TestTable_".RandomLetters(4) }; TestFkTable fkTable = new TestFkTable { Name = "TestFkTable_".RandomLetters(6) }; testTable.Save(db); testTable.TestFkTablesByTestTableId.Add(fkTable); fkTable.Id.ShouldBeNull(); testTable.Save(db); fkTable.Id.ShouldNotBeNull(); TestTable retrieved = TestTable.GetById(testTable.Id, db); Expect.AreEqual(1, retrieved.TestFkTablesByTestTableId.Count); Expect.AreEqual(fkTable.ToJsonSafe().ToJson(), retrieved.TestFkTablesByTestTableId[0].ToJsonSafe().ToJson()); }