public void Rollback_Method()
 {
   using (var connection = this.Connection())
   {
     var transaction = new AdoNetTransaction(connection);
     Assert.True(ReferenceEquals(transaction.Rollback(), transaction));
     Assert.False(transaction.Field("disposed").To<bool>());
     Assert.False(transaction.Field("wasCommitted").To<bool>());
     Assert.True(transaction.Field("wasRolledBack").To<bool>());
   }
 }
 public void Rollback_Method()
 {
     using (var connection = this.Connection())
     {
         var transaction = new AdoNetTransaction(connection);
         Assert.True(ReferenceEquals(transaction.Rollback(), transaction));
         Assert.False(transaction.Field("disposed").To <bool>());
         Assert.False(transaction.Field("wasCommitted").To <bool>());
         Assert.True(transaction.Field("wasRolledBack").To <bool>());
     }
 }
 public void Dispose_Method()
 {
   using (var connection = this.Connection())
   {
     var transaction = new AdoNetTransaction(connection);
     transaction.Dispose();
     Assert.True(transaction.Field("disposed").To<bool>());
     Assert.False(transaction.Field("wasCommitted").To<bool>());
     Assert.False(transaction.Field("wasRolledBack").To<bool>());
     Assert.Throws<ObjectDisposedException>(() => transaction.Dispose());
   }
 }
 public void Dispose_Method()
 {
     using (var connection = this.Connection())
     {
         var transaction = new AdoNetTransaction(connection);
         transaction.Dispose();
         Assert.True(transaction.Field("disposed").To <bool>());
         Assert.False(transaction.Field("wasCommitted").To <bool>());
         Assert.False(transaction.Field("wasRolledBack").To <bool>());
         Assert.Throws <ObjectDisposedException>(() => transaction.Dispose());
     }
 }
    public void Constructors()
    {
      Assert.Throws<ArgumentNullException>(() => new AdoNetTransaction(null));

      using (var connection = this.Connection())
      {
        using (var transaction = new AdoNetTransaction(connection))
        {
          Assert.Equal(IsolationLevel.ReadCommitted, transaction.IsolationLevel);
          Assert.False(transaction.Field("disposed").To<bool>());
          Assert.False(transaction.Field("wasCommitted").To<bool>());
          Assert.False(transaction.Field("wasRolledBack").To<bool>());
        }
        using (var transaction = new AdoNetTransaction(connection, IsolationLevel.ReadCommitted))
        {
          Assert.Equal(IsolationLevel.ReadCommitted, transaction.IsolationLevel);
          Assert.False(transaction.Field("disposed").To<bool>());
          Assert.False(transaction.Field("wasCommitted").To<bool>());
          Assert.False(transaction.Field("wasRolledBack").To<bool>());
        }
      }
    }
        public void Constructors()
        {
            Assert.Throws <ArgumentNullException>(() => new AdoNetTransaction(null));

            using (var connection = this.Connection())
            {
                using (var transaction = new AdoNetTransaction(connection))
                {
                    Assert.Equal(IsolationLevel.ReadCommitted, transaction.IsolationLevel);
                    Assert.False(transaction.Field("disposed").To <bool>());
                    Assert.False(transaction.Field("wasCommitted").To <bool>());
                    Assert.False(transaction.Field("wasRolledBack").To <bool>());
                }
                using (var transaction = new AdoNetTransaction(connection, IsolationLevel.ReadCommitted))
                {
                    Assert.Equal(IsolationLevel.ReadCommitted, transaction.IsolationLevel);
                    Assert.False(transaction.Field("disposed").To <bool>());
                    Assert.False(transaction.Field("wasCommitted").To <bool>());
                    Assert.False(transaction.Field("wasRolledBack").To <bool>());
                }
            }
        }