Пример #1
0
        public void PostgreSql_ToSingleOrDefault_Works()
        {
            IDatabaseConnection connection = GetConnection();

            var repo = new PostgreSqlIntegrationRepository(GetConnection());

            repo.ToSingleOrDefault();
        }
Пример #2
0
        public void PostgreSql_SprocWithParameter_Works()
        {
            IDatabaseConnection connection = GetConnection();
            InitializeDatabase(connection);

            var repo = new PostgreSqlIntegrationRepository(GetConnection());
            Assert.AreEqual(143, repo.SprocWithParameter(143));
        }
Пример #3
0
        public void PostgreSql_ManyQueries_DoesntFail()
        {
            IDatabaseConnection connection = GetConnection();

            var repo = new PostgreSqlIntegrationRepository(GetConnection());

            for (int ii = 0; ii < 100; ii++) {
                repo.ExecuteAdHocQuery("SELECT 1");
            }
        }
Пример #4
0
        public void PostgreSql_SprocWithSchema_Works()
        {
            IDatabaseConnection connection = GetConnection();

            InitializeDatabase(connection);

            var repo = new PostgreSqlIntegrationRepository(GetConnection());

            Assert.AreEqual(123, repo.SprocWithSchema());
        }
Пример #5
0
        public void PostgreSql_ToScalar_Works()
        {
            IDatabaseConnection connection = GetConnection();

            InitializeDatabase(connection);

            var repo = new PostgreSqlIntegrationRepository(GetConnection());

            Assert.AreEqual(142, repo.ToScalar());
        }
Пример #6
0
        public void PostgreSql_ManyQueries_DoesntFail()
        {
            IDatabaseConnection connection = GetConnection();

            var repo = new PostgreSqlIntegrationRepository(GetConnection());

            for (int ii = 0; ii < 100; ii++)
            {
                repo.ExecuteAdHocQuery("SELECT 1");
            }
        }
Пример #7
0
        public void PostgreSql_RollbackTransaction_DoesntHaveSideEffect()
        {
            IDatabaseConnection connection = GetConnection();
            InitializeDatabase(connection);

            var repo = new PostgreSqlIntegrationRepository(GetConnection());
            using (var transaction = repo.WithTransaction()) {
                repo.SprocWithSideEffect();
                transaction.Rollback();
            }

            Assert.AreEqual(0, repo.GetCountOfSideEffects());
        }
Пример #8
0
        public void PostgreSql_CommitTransaction_HasSideEffect()
        {
            IDatabaseConnection connection = GetConnection();
            InitializeDatabase(connection);

            var repo = new PostgreSqlIntegrationRepository(GetConnection());
            using (var transaction = repo.WithTransaction()) {
                repo.SprocWithSideEffect();
                transaction.Commit();
            }

            Assert.AreEqual(1, repo.GetCountOfSideEffects());
        }
Пример #9
0
        public void PostgreSql_RollbackTransaction_DoesntHaveSideEffect()
        {
            IDatabaseConnection connection = GetConnection();

            InitializeDatabase(connection);

            var repo = new PostgreSqlIntegrationRepository(GetConnection());

            using (var transaction = repo.WithTransaction()) {
                repo.SprocWithSideEffect();
                transaction.Rollback();
            }

            Assert.AreEqual(0, repo.GetCountOfSideEffects());
        }
Пример #10
0
        public void PostgreSql_CommitTransaction_HasSideEffect()
        {
            IDatabaseConnection connection = GetConnection();

            InitializeDatabase(connection);

            var repo = new PostgreSqlIntegrationRepository(GetConnection());

            using (var transaction = repo.WithTransaction()) {
                repo.SprocWithSideEffect();
                transaction.Commit();
            }

            Assert.AreEqual(1, repo.GetCountOfSideEffects());
        }
Пример #11
0
        public void PostgreSql_ToScalar_Works()
        {
            IDatabaseConnection connection = GetConnection();
            InitializeDatabase(connection);

            var repo = new PostgreSqlIntegrationRepository(GetConnection());
            Assert.AreEqual(142, repo.ToScalar());
        }
Пример #12
0
        public void PostgreSql_ToSingleOrDefault_Works()
        {
            IDatabaseConnection connection = GetConnection();

            var repo = new PostgreSqlIntegrationRepository(GetConnection());
            repo.ToSingleOrDefault();
        }