public void CannotGetCommandForStoredProcedure()
 {
     TestConnectionString testConnection = new TestConnectionString();
     testConnection.CopyFile();
     SqlCeDatabase db = new SqlCeDatabase(testConnection.ConnectionString);
     db.GetStoredProcCommand("CustOrdersOrders");
 }
Exemplo n.º 2
0
        public void SetUp()
        {
            TestConnectionString testConnection = new TestConnectionString();

            testConnection.CopyFile();
            db = new SqlCeDatabase(testConnection.ConnectionString);
        }
        public void TearDown()
        {
            SqlCeConnectionPool.CloseSharedConnections();
            TestConnectionString test = new TestConnectionString();

            test.DeleteFile();
        }
Exemplo n.º 4
0
        public void CloseConnections()
        {
            SqlCeConnectionPool.CloseSharedConnections();
            TestConnectionString testConnection = new TestConnectionString();

            testConnection.DeleteFile();
        }
 public void SetUp()
 {
     TestConnectionString testConnection = new TestConnectionString();
     testConnection.CopyFile();
     db = new SqlCeDatabase(testConnection.ConnectionString);
     baseFixture = new DataAccessTestsFixture(db);
 }
        public void SetUp()
        {
            TestConnectionString testConnection = new TestConnectionString();

            testConnection.CopyFile();
            db          = new SqlCeDatabase(testConnection.ConnectionString);
            baseFixture = new DataAccessTestsFixture(db);
        }
        public void TestInitialize()
        {
            testConnection = new TestConnectionString();
            testConnection.CopyFile();
            db = new SqlCeDatabase(testConnection.ConnectionString);

            base.SetUp();
        }
Exemplo n.º 8
0
        public void CreateNewDatabaseThrowsWhenFileAlreadyExists()
        {
            TestConnectionString file = new TestConnectionString();

            Assert.IsTrue(File.Exists(file.Filename));
            SqlCeDatabase database = new SqlCeDatabase(file.ConnectionString);

            database.CreateFile();
        }
        public void ConnectionShouldRemainInPoolAfterReturnedConnectionDisposed()
        {
            TestConnectionString testConnection = new TestConnectionString();
            SqlCeDatabase db = new SqlCeDatabase(testConnection.ConnectionString);
            using (DatabaseConnectionWrapper connection = SqlCeConnectionPool.CreateConnection(db)) {}

            DatabaseConnectionWrapper keepAlive = TestableSqlCeConnectionPool.GetConnection(0);
            Assert.AreEqual(ConnectionState.Open, keepAlive.Connection.State);
        }
        public void SetUp()
        {
            testConnection = new TestConnectionString();
            testConnection.CopyFile();
            db = new SqlCeDatabase(testConnection.ConnectionString);
            DbCommand command = db.GetSqlStringCommand("Select count(*) from region");

            baseFixture = new ExecuteScalarFixture(db, command);
        }
Exemplo n.º 11
0
        public void SetUp()
        {
            testConnection = new TestConnectionString();
            testConnection.CopyFile();
            db = new SqlCeDatabase(testConnection.ConnectionString);
            DbCommand command = db.GetSqlStringCommand("Select count(*) from region");

            baseFixture = new ExecuteScalarFixture(db, command);
        }
        public void CannotGetCommandForStoredProcedure()
        {
            TestConnectionString testConnection = new TestConnectionString();

            testConnection.CopyFile();
            SqlCeDatabase db = new SqlCeDatabase(testConnection.ConnectionString);

            db.GetStoredProcCommand("CustOrdersOrders");
        }
Exemplo n.º 13
0
        public void SetUp()
        {
            testConnection = new TestConnectionString();
            testConnection.CopyFile();
            db = new SqlCeDatabase(testConnection.ConnectionString);
            DbCommand insertionCommand = db.GetSqlStringCommand(insertString);
            DbCommand countCommand     = db.GetSqlStringCommand(countQuery);

            baseFixture = new ExecuteNonQueryFixture(db, insertString, countQuery, insertionCommand, countCommand);
        }
Exemplo n.º 14
0
        public void ConnectionShouldRemainInPoolAfterReturnedConnectionDisposed()
        {
            TestConnectionString testConnection = new TestConnectionString();
            SqlCeDatabase        db             = new SqlCeDatabase(testConnection.ConnectionString);

            using (DbConnection connection = SqlCeConnectionPool.CreateConnection(db)) {}
            DbConnection keepAlive = TestableSqlCeConnectionPool.GetConnection(0);

            Assert.AreEqual(ConnectionState.Open, keepAlive.State);
        }
Exemplo n.º 15
0
        public void DatabaseShouldCloseSharedConnection()
        {
            TestConnectionString file     = new TestConnectionString();
            SqlCeDatabase        database = new SqlCeDatabase(file.ConnectionString);

            using (DbConnection connection = SqlCeConnectionPool.CreateConnection(database)) {}
            Assert.AreEqual(1, TestableSqlCeConnectionPool.PoolSize);
            database.CloseSharedConnection();
            Assert.AreEqual(0, TestableSqlCeConnectionPool.PoolSize);
        }
        public void TestInitialize()
        {
            testConnection = new TestConnectionString();
            testConnection.CopyFile();
            db = new SqlCeDatabase(testConnection.ConnectionString);
            DbCommand insertCommand = db.GetSqlStringCommand(insertString);
            DbCommand queryCommand  = db.GetSqlStringCommand(queryString);

            baseFixture = new ExecuteReaderFixture(db, insertString, insertCommand, queryString, queryCommand);
        }
 public void GetConnectionOpensConnectionInPool()
 {
     TestConnectionString testConnection = new TestConnectionString();
     SqlCeDatabase db = new SqlCeDatabase(testConnection.ConnectionString);
     using (DatabaseConnectionWrapper connection = SqlCeConnectionPool.CreateConnection(db))
     {
         DatabaseConnectionWrapper keepAlive = TestableSqlCeConnectionPool.GetConnection(0);
         Assert.AreEqual(ConnectionState.Open, keepAlive.Connection.State);
     }
 }
 public void GetConnectionAddsConnectionToPool()
 {
     TestConnectionString testConnection = new TestConnectionString();
     SqlCeDatabase db = new SqlCeDatabase(testConnection.ConnectionString);
     using (DatabaseConnectionWrapper connection = SqlCeConnectionPool.CreateConnection(db))
     {
         Assert.IsNotNull(connection);
         Assert.AreEqual(1, TestableSqlCeConnectionPool.PoolSize);
     }
 }
Exemplo n.º 19
0
        public void PoolShouldCloseSharedConnection()
        {
            TestConnectionString testConnection = new TestConnectionString();
            SqlCeDatabase        db             = new SqlCeDatabase(testConnection.ConnectionString);

            using (DatabaseConnectionWrapper connection = SqlCeConnectionPool.CreateConnection(db)) {}
            Assert.AreEqual(1, TestableSqlCeConnectionPool.PoolSize);
            SqlCeConnectionPool.CloseSharedConnection(db);
            Assert.AreEqual(0, TestableSqlCeConnectionPool.PoolSize);
        }
        public void CloseSharedConnectionsShouldClearPool()
        {
            TestConnectionString testConnection = new TestConnectionString();
            SqlCeDatabase db = new SqlCeDatabase(testConnection.ConnectionString);
            using (DatabaseConnectionWrapper connection = SqlCeConnectionPool.CreateConnection(db)) {}

            Assert.AreEqual(1, TestableSqlCeConnectionPool.PoolSize);
            SqlCeConnectionPool.CloseSharedConnections();
            Assert.AreEqual(0, TestableSqlCeConnectionPool.PoolSize);
        }
Exemplo n.º 21
0
        public void CanOpenSqlCeDatabase()
        {
            TestConnectionString testConnection = new TestConnectionString();
            SqlCeDatabase        database       = new SqlCeDatabase(testConnection.ConnectionString);

            using (DbConnection connection = database.CreateConnection())
            {
                connection.Open();
                Assert.AreEqual(ConnectionState.Open, connection.State);
            }
        }
Exemplo n.º 22
0
        public void GetConnectionOpensConnectionInPool()
        {
            TestConnectionString testConnection = new TestConnectionString();
            SqlCeDatabase        db             = new SqlCeDatabase(testConnection.ConnectionString);

            using (DatabaseConnectionWrapper connection = SqlCeConnectionPool.CreateConnection(db))
            {
                DatabaseConnectionWrapper keepAlive = TestableSqlCeConnectionPool.GetConnection(0);
                Assert.AreEqual(ConnectionState.Open, keepAlive.Connection.State);
            }
        }
Exemplo n.º 23
0
        public void GetConnectionAddsConnectionToPool()
        {
            TestConnectionString testConnection = new TestConnectionString();
            SqlCeDatabase        db             = new SqlCeDatabase(testConnection.ConnectionString);

            using (DatabaseConnectionWrapper connection = SqlCeConnectionPool.CreateConnection(db))
            {
                Assert.IsNotNull(connection);
                Assert.AreEqual(1, TestableSqlCeConnectionPool.PoolSize);
            }
        }
Exemplo n.º 24
0
        public void GetConnectionReturnsDifferentConnectionThanOneInPool()
        {
            TestConnectionString testConnection = new TestConnectionString();
            SqlCeDatabase        db             = new SqlCeDatabase(testConnection.ConnectionString);

            using (DatabaseConnectionWrapper connection = SqlCeConnectionPool.CreateConnection(db))
            {
                DatabaseConnectionWrapper keepAlive = TestableSqlCeConnectionPool.GetConnection(0);
                Assert.AreNotSame(connection, keepAlive);
            }
        }
        public void TestInitialize()
        {
            testConnection = new TestConnectionString();
            testConnection.CopyFile();
            db = new SqlCeDatabase(testConnection.ConnectionString);

            DbCommand insertCommand = db.GetSqlStringCommand(insertString);
            queryCommand = db.GetSqlStringCommand(queryString);

            baseFixture = new ExecuteReaderFixture(db, insertString, insertCommand, queryString, queryCommand);
        }
        public void SetUp()
        {
            testConnection = new TestConnectionString();
            testConnection.CopyFile();
            db = new SqlCeDatabase(testConnection.ConnectionString);

            DbCommand insertionCommand = db.GetSqlStringCommand(insertString);
            DbCommand countCommand = db.GetSqlStringCommand(countQuery);

            baseFixture = new ExecuteNonQueryFixture(db, insertString, countQuery, insertionCommand, countCommand);
        }
Exemplo n.º 27
0
        public void ExecuteSqlCreatesConnectionInPool()
        {
            TestConnectionString testConnection = new TestConnectionString();
            SqlCeDatabase        db             = new SqlCeDatabase(testConnection.ConnectionString);
            DbCommand            command        = db.GetSqlStringCommand("select count(*) from region");

            Assert.AreEqual(0, TestableSqlCeConnectionPool.PoolSize);
            int result = (int)db.ExecuteScalar(command);

            Assert.AreEqual(4, result);
            Assert.AreEqual(1, TestableSqlCeConnectionPool.PoolSize);
        }
Exemplo n.º 28
0
        public void GetConnectionReturnsNewConnectionButHasOnlyOneInPool()
        {
            TestConnectionString testConnection = new TestConnectionString();
            SqlCeDatabase        db             = new SqlCeDatabase(testConnection.ConnectionString);

            using (DatabaseConnectionWrapper connection1 = SqlCeConnectionPool.CreateConnection(db))
            {
                using (DatabaseConnectionWrapper connection2 = SqlCeConnectionPool.CreateConnection(db))
                {
                    Assert.AreNotSame(connection1, connection2);
                    Assert.AreEqual(1, TestableSqlCeConnectionPool.PoolSize);
                }
            }
        }
Exemplo n.º 29
0
        public void GetConnectionWithPoolingReturnsSameConnection()
        {
            TestConnectionString testConnection = new TestConnectionString();
            SqlCeDatabase        db             = new SqlCeDatabase(testConnection.ConnectionString);

            using (DatabaseConnectionWrapper connection1 = SqlCeConnectionPool.CreateConnection(db, true))
            {
                using (DatabaseConnectionWrapper connection2 = SqlCeConnectionPool.CreateConnection(db, true))
                {
                    Assert.AreSame(connection1, connection2);
                    Assert.AreEqual(1, TestableSqlCeConnectionPool.PoolSize);
                }
            }
        }
Exemplo n.º 30
0
        public void GetConnectionForTwoFilesAddsTwoConnectionsToPool()
        {
            TestConnectionString file1 = new TestConnectionString();
            TestConnectionString file2 = new TestConnectionString("test2.sdf");

            file2.CopyFile();
            SqlCeDatabase db1 = new SqlCeDatabase(file1.ConnectionString);
            SqlCeDatabase db2 = new SqlCeDatabase(file2.ConnectionString);

            using (DbConnection connection1 = SqlCeConnectionPool.CreateConnection(db1))
            {
                using (DbConnection connection2 = SqlCeConnectionPool.CreateConnection(db2)) {}
            }
            Assert.AreEqual(2, TestableSqlCeConnectionPool.PoolSize);
            SqlCeConnectionPool.CloseSharedConnections();
            file2.DeleteFile();
        }
 public void GetConnectionReturnsDifferentConnectionThanOneInPool()
 {
     TestConnectionString testConnection = new TestConnectionString();
     SqlCeDatabase db = new SqlCeDatabase(testConnection.ConnectionString);
     using (DatabaseConnectionWrapper connection = SqlCeConnectionPool.CreateConnection(db))
     {
         DatabaseConnectionWrapper keepAlive = TestableSqlCeConnectionPool.GetConnection(0);
         Assert.AreNotSame(connection, keepAlive);
     }
 }
Exemplo n.º 32
0
        public void Initialize()
        {
            TestConnectionString test = new TestConnectionString();

            test.CopyFile();
        }
Exemplo n.º 33
0
        public void CopyDatabase()
        {
            TestConnectionString testConnection = new TestConnectionString();

            testConnection.CopyFile();
        }
 public void SetUp()
 {
     TestConnectionString testConnection = new TestConnectionString();
     testConnection.CopyFile();
     db = new SqlCeDatabase(testConnection.ConnectionString);
 }
        private static SqlCeDatabase GetDatabase(IDataInstrumentationProvider instrumentationProvider)
        {
            var testConnection = new TestConnectionString();
            testConnection.CopyFile();

            return new SqlCeDatabase(testConnection.ConnectionString, instrumentationProvider);
        }
Exemplo n.º 36
0
 public void TestInitialize()
 {
     testConnection = new TestConnectionString();
     testConnection.CopyFile();
     db = new SqlCeDatabase(testConnection.ConnectionString);
 }
        public void ExecuteSqlCreatesConnectionInPool()
        {
            TestConnectionString testConnection = new TestConnectionString();
            SqlCeDatabase db = new SqlCeDatabase(testConnection.ConnectionString);

            DbCommand command = db.GetSqlStringCommand("select count(*) from region");
            Assert.AreEqual(0, TestableSqlCeConnectionPool.PoolSize);
            int result = (int)db.ExecuteScalar(command);
            Assert.AreEqual(4, result);
            Assert.AreEqual(1, TestableSqlCeConnectionPool.PoolSize);
        }
        public void DatabaseShouldCloseSharedConnection()
        {
            TestConnectionString file = new TestConnectionString();

            SqlCeDatabase database = new SqlCeDatabase(file.ConnectionString);
            using (DatabaseConnectionWrapper connection = SqlCeConnectionPool.CreateConnection(database)) {}

            Assert.AreEqual(1, TestableSqlCeConnectionPool.PoolSize);
            database.CloseSharedConnection();
            Assert.AreEqual(0, TestableSqlCeConnectionPool.PoolSize);
        }
 public void TearDown()
 {
     SqlCeConnectionPool.CloseSharedConnections();
     TestConnectionString test = new TestConnectionString();
     test.DeleteFile();
 }
 public void CopyDatabase()
 {
     TestConnectionString testConnection = new TestConnectionString();
     testConnection.CopyFile();
 }
 public void Initialize()
 {
     TestConnectionString test = new TestConnectionString();
     test.CopyFile();
 }
 public void GetConnectionReturnsNewConnectionButHasOnlyOneInPool()
 {
     TestConnectionString testConnection = new TestConnectionString();
     SqlCeDatabase db = new SqlCeDatabase(testConnection.ConnectionString);
     using (DatabaseConnectionWrapper connection1 = SqlCeConnectionPool.CreateConnection(db))
     {
         using (DatabaseConnectionWrapper connection2 = SqlCeConnectionPool.CreateConnection(db))
         {
             Assert.AreNotSame(connection1, connection2);
             Assert.AreEqual(1, TestableSqlCeConnectionPool.PoolSize);
         }
     }
 }
 public void CloseConnections()
 {
     SqlCeConnectionPool.CloseSharedConnections();
     TestConnectionString testConnection = new TestConnectionString();
     testConnection.DeleteFile();
 }
        public void CreateNewDatabaseThrowsWhenFileAlreadyExists()
        {
            TestConnectionString file = new TestConnectionString();

            Assert.IsTrue(File.Exists(file.Filename));
            SqlCeDatabase database = new SqlCeDatabase(file.ConnectionString);
            database.CreateFile();
        }
 public void GetConnectionWithPoolingReturnsSameConnection()
 {
     TestConnectionString testConnection = new TestConnectionString();
     SqlCeDatabase db = new SqlCeDatabase(testConnection.ConnectionString);
     using (DatabaseConnectionWrapper connection1 = SqlCeConnectionPool.CreateConnection(db, true))
     {
         using (DatabaseConnectionWrapper connection2 = SqlCeConnectionPool.CreateConnection(db, true))
         {
             Assert.AreSame(connection1, connection2);
             Assert.AreEqual(1, TestableSqlCeConnectionPool.PoolSize);
         }
     }
     
 }
        public void GetConnectionForTwoFilesAddsTwoConnectionsToPool()
        {
            TestConnectionString file1 = new TestConnectionString();
            TestConnectionString file2 = new TestConnectionString("test2.sdf");
            file2.CopyFile();

            SqlCeDatabase db1 = new SqlCeDatabase(file1.ConnectionString);
            SqlCeDatabase db2 = new SqlCeDatabase(file2.ConnectionString);

            using (DatabaseConnectionWrapper connection1 = SqlCeConnectionPool.CreateConnection(db1))
            {
                using (DatabaseConnectionWrapper connection2 = SqlCeConnectionPool.CreateConnection(db2)) {}
            }
            Assert.AreEqual(2, TestableSqlCeConnectionPool.PoolSize);

            SqlCeConnectionPool.CloseSharedConnections();
            file2.DeleteFile();
        }
        public void CanOpenSqlCeDatabase()
        {
            TestConnectionString testConnection = new TestConnectionString();
            SqlCeDatabase database = new SqlCeDatabase(testConnection.ConnectionString);

            using (DbConnection connection = database.CreateConnection())
            {
                connection.Open();
                Assert.AreEqual(ConnectionState.Open, connection.State);
            }
        }