public async Task When_creating_connection()
        {
            var sampleDbs = GetSampleDBs();

            using (var conn = new SQLiteAttachedConnection(sampleDbs))
            {
                conn.FilesToAttach.ShouldBe(sampleDbs);

                conn.ConnectionString.ShouldBe("Data Source=:memory:");
                conn.ConnectionTimeout.ShouldBe(15);
                conn.DataSource.ShouldBeNull();
                conn.Database.ShouldBe("main");
                conn.ServerVersion.ShouldBe("3.28.0");
                conn.State.ShouldBe(ConnectionState.Closed);

                var attachedDbs = await conn.GetAttachedDatabases();

                attachedDbs.Count.ShouldBe(4);

                attachedDbs["main"].ShouldBeNull();
                attachedDbs["a"].FullName.ShouldBe(sampleDbs["a"].FullName);
                attachedDbs["b"].FullName.ShouldBe(sampleDbs["b"].FullName);
                attachedDbs["c"].FullName.ShouldBe(sampleDbs["c"].FullName);

                conn.Close();

                attachedDbs = await conn.GetAttachedDatabases();

                attachedDbs.Count.ShouldBe(4);

                conn.DataSource.ShouldBe(":memory:");
            }
        }
        public void When_changing_connection_state()
        {
            var sampleDbs = GetSampleDBs();

            var conn = new SQLiteAttachedConnection(sampleDbs);

            conn.State.ShouldBe(ConnectionState.Closed);

            conn.Open();

            conn.State.ShouldBe(ConnectionState.Open);

            conn.Close();
            conn.State.ShouldBe(ConnectionState.Closed);

            conn.Dispose();

            Should.Throw <ObjectDisposedException>(() => conn.State.ShouldBe(ConnectionState.Closed))
            .Message.ShouldBe("Cannot access a disposed object.\r\nObject name: 'SQLiteConnection'.");
        }
        public async Task When_querying_attached_files()
        {
            var sampleDbs = GetSampleDBs();

            using (var conn = new SQLiteAttachedConnection(sampleDbs))
            {
                conn.FilesToAttach.ShouldBe(sampleDbs);
                conn.State.ShouldBe(ConnectionState.Closed);

                var attachedDbs = await conn.GetAttachedDatabases();

                attachedDbs.Count.ShouldBe(4);

                attachedDbs.ShouldContainKey("main");
                attachedDbs["main"].ShouldBeNull();

                attachedDbs.ShouldContainKey("a");
                attachedDbs["a"].FullName.ShouldBe(sampleDbs["a"].FullName);

                attachedDbs.ShouldContainKey("b");
                attachedDbs["b"].FullName.ShouldBe(sampleDbs["b"].FullName);

                attachedDbs.ShouldContainKey("c");
                attachedDbs["c"].FullName.ShouldBe(sampleDbs["c"].FullName);

                (await conn.ExecuteScalarAsync <int>("SELECT COUNT(Id) FROM a.Person"))
                .ShouldBe(3);

                (await conn.ExecuteScalarAsync <int>("SELECT COUNT(Id) FROM b.Person"))
                .ShouldBe(3);

                (await conn.ExecuteScalarAsync <int>("SELECT COUNT(Id) FROM c.Person"))
                .ShouldBe(3);

                (await conn.ExecuteAsync("DELETE FROM b.Person"))
                .ShouldBe(3);

                (await conn.ExecuteScalarAsync <int>("SELECT COUNT(Id) FROM b.Person"))
                .ShouldBe(0);
            }
        }