Npgsql.Tests.SystemTransactionTests.OneTimeSetUp C# (CSharp) Method

OneTimeSetUp() private method

private OneTimeSetUp ( ) : void
return void
        public void OneTimeSetUp()
        {
            using (new TransactionScope(TransactionScopeOption.RequiresNew))
            {
                try
                {
                    Transaction.Current.EnlistPromotableSinglePhase(new FakePromotableSinglePhaseNotification());
                }
                catch (NotImplementedException)
                {
                    Assert.Ignore("Promotable single phase transactions aren't supported (mono < 3.0.0?)");
                }
            }

            // All tests in this fixture should have totally access to the database they're running on.
            // If we run these tests in parallel (i.e. two builds in parallel) they will interfere.
            // Solve this by taking a PostgreSQL advisory lock for the lifetime of the fixture.
            _controlConn = OpenConnection();
            _controlConn.ExecuteNonQuery("SELECT pg_advisory_lock(666)");
        }