Пример #1
0
        static void Main()
        {
            CreateDatabase();

            Console.WriteLine("Insert");
            InsertRecords();
            DumpRecords();

            Console.WriteLine();
            Console.WriteLine("Delete");
            DeleteRecords();
            DumpRecords();

            Console.WriteLine();
            Console.WriteLine("Update");
            UpdateRecords();
            DumpRecords();

            Console.WriteLine();
            Console.WriteLine("Execute SQL");
            SqlConnection sql = Esent.CreateSqlConnection();

            sql.Execute(String.Format("ATTACH DATABASE '{0}'", Database));
            sql.Execute("INSERT INTO mytable (myid, mydata) VALUES (101, 'this data inserted through SQL')");
            DumpRecords();
        }
        public void SqlCreateDatabaseCallsConnectionFactory()
        {
            Expect.Call(this.mockConnectionManager.CreateDatabase("sql.edb", DatabaseCreationMode.None)).Return(this.dummyConnection);
            this.mocks.ReplayAll();
            SqlConnection sql = Esent.CreateSqlConnection();

            sql.Execute("CREATE DATABASE 'sql.edb'");
            this.mocks.VerifyAll();
        }
        public void SqlAttachDatabaseCallsConnectionFactory()
        {
            Expect.Call(this.mockConnectionManager.AttachDatabase("sql.edb", DatabaseOpenMode.ReadWrite)).Return(this.dummyConnection);
            this.mocks.ReplayAll();
            SqlConnection sql = Esent.CreateSqlConnection();

            sql.Execute("ATTACH DATABASE 'sql.edb'");
            this.mocks.VerifyAll();
        }
Пример #4
0
 public void Setup()
 {
     this.directory = "sql_connection_tests";
     this.database  = Path.Combine(this.directory, "sql.edb");
     this.sql       = Esent.CreateSqlConnection();
 }