public void CreateConnectionTest() {

            var database = new NpgsqlDatabase(ConnectionString);
            database.Should().Not.Be.Null();

            using(var connection = (NpgsqlConnection)database.CreateConnection()) {
                connection.Open();

                connection.State.Should().Be(ConnectionState.Open);
            }
        }
Example #2
0
        public void CreateConnectionTest()
        {
            var database = new NpgsqlDatabase(ConnectionString);

            database.Should().Not.Be.Null();

            using (var connection = (NpgsqlConnection)database.CreateConnection()) {
                connection.Open();

                connection.State.Should().Be(ConnectionState.Open);
            }
        }
        public void ExecuteReaderTest() {

            var database = new NpgsqlDatabase(ConnectionString);
            database.Should().Not.Be.Null();

            using(var connection = (NpgsqlConnection)database.CreateConnection()) {
                connection.Open();
                connection.State.Should().Be(ConnectionState.Open);

                using(var cmd = new NpgsqlCommand("SELECT * FROM Invoices", connection)) {
                    using(var reader = cmd.ExecuteReader()) {
                        Console.WriteLine(reader.ToString(true));
                    }
                }
            }
        }
Example #4
0
        public void ExecuteReaderTest()
        {
            var database = new NpgsqlDatabase(ConnectionString);

            database.Should().Not.Be.Null();

            using (var connection = (NpgsqlConnection)database.CreateConnection()) {
                connection.Open();
                connection.State.Should().Be(ConnectionState.Open);

                using (var cmd = new NpgsqlCommand("SELECT * FROM Invoices", connection)) {
                    using (var reader = cmd.ExecuteReader()) {
                        Console.WriteLine(reader.ToString(true));
                    }
                }
            }
        }