public async Task When_getting_objects_of_a_table() { using (var conn = new SQLiteInMemoryConnection()) { var snapshot1 = (await conn.GetDatabaseObjects()).ToArray(); snapshot1.ShouldNotBeNull(); snapshot1.ShouldBeEmpty(); await conn.ExecuteAsync(TableQuery); var snapshot2 = (await conn.GetDatabaseObjects()).ToArray(); snapshot2.ShouldNotBeNull(); snapshot2.Length.ShouldBe(1); snapshot2[0].Type.ShouldBe(SQLiteObjectType.Table); snapshot2[0].Name.ShouldBe("Person"); snapshot2[0].SQL.ShouldBe(TableQuery.Replace("IF NOT EXISTS ", string.Empty).Replace(";", string.Empty)); await conn.ExecuteAsync(ViewQuery); var snapshot3 = (await conn.GetDatabaseObjects()).ToArray(); snapshot3.ShouldNotBeNull(); snapshot3.Length.ShouldBe(2); snapshot3[0].Type.ShouldBe(SQLiteObjectType.Table); snapshot3[0].Name.ShouldBe("Person"); snapshot3[0].SQL.ShouldBe(TableQuery.Replace("IF NOT EXISTS ", string.Empty).Replace(";", string.Empty)); snapshot3[1].Type.ShouldBe(SQLiteObjectType.View); snapshot3[1].Name.ShouldBe("Person_view"); snapshot3[1].SQL.ShouldBe(ViewQuery.Replace("IF NOT EXISTS ", string.Empty).Replace(";", string.Empty)); await conn.ExecuteAsync(TriggerQuery); var snapshot4 = (await conn.GetDatabaseObjects()).ToArray(); snapshot4.ShouldNotBeNull(); snapshot4.Length.ShouldBe(3); snapshot4[0].Type.ShouldBe(SQLiteObjectType.Table); snapshot4[0].Name.ShouldBe("Person"); snapshot4[0].SQL.ShouldBe(TableQuery.Replace("IF NOT EXISTS ", string.Empty).Replace(";", string.Empty)); snapshot4[1].Type.ShouldBe(SQLiteObjectType.View); snapshot4[1].Name.ShouldBe("Person_view"); snapshot4[1].SQL.ShouldBe(ViewQuery.Replace("IF NOT EXISTS ", string.Empty).Replace(";", string.Empty)); snapshot4[2].Type.ShouldBe(SQLiteObjectType.Trigger); snapshot4[2].Name.ShouldBe("Person_bu"); snapshot4[2].SQL.ShouldBe(TriggerQuery.Replace("IF NOT EXISTS ", string.Empty)); await conn.ExecuteAsync(IndexQuery); var snapshot5 = (await conn.GetDatabaseObjects()).ToArray(); snapshot5.ShouldNotBeNull(); snapshot5.Length.ShouldBe(4); snapshot5[0].Type.ShouldBe(SQLiteObjectType.Table); snapshot5[0].Name.ShouldBe("Person"); snapshot5[0].SQL.ShouldBe(TableQuery.Replace("IF NOT EXISTS ", string.Empty).Replace(";", string.Empty)); snapshot5[1].Type.ShouldBe(SQLiteObjectType.View); snapshot5[1].Name.ShouldBe("Person_view"); snapshot5[1].SQL.ShouldBe(ViewQuery.Replace("IF NOT EXISTS ", string.Empty).Replace(";", string.Empty)); snapshot5[2].Type.ShouldBe(SQLiteObjectType.Trigger); snapshot5[2].Name.ShouldBe("Person_bu"); snapshot5[2].SQL.ShouldBe(TriggerQuery.Replace("IF NOT EXISTS ", string.Empty)); snapshot5[3].Type.ShouldBe(SQLiteObjectType.Index); snapshot5[3].Name.ShouldBe("Person_idx"); snapshot5[3].SQL.ShouldBe(IndexQuery.Replace("IF NOT EXISTS ", string.Empty).Replace(";", string.Empty)); } }