public TestCasesDialog()
    {
      InitializeComponent();

      using (DataTable tbl = DbProviderFactories.GetFactoryClasses())
      {
        foreach (DataRow row in tbl.Rows)
        {
          string prov = row[2].ToString();

          if (prov.IndexOf("SQLite", 0, StringComparison.OrdinalIgnoreCase) != -1
            || prov.IndexOf("SqlClient", 0, StringComparison.OrdinalIgnoreCase) != -1
            )
            _provider.Items.Add(prov);
          if (prov == "System.Data.SQLite") _provider.SelectedItem = prov;
        }
      }
      _connectionString.Items.Add("Data Source=Test.db3;Pooling=true;FailIfMissing=false");
      _connectionString.Items.Add("Data Source=(local);Initial Catalog=sqlite;Integrated Security=True;Max Pool Size=10");
      _connectionString.SelectedIndex = 0;

      _testitems = new TestCases();
      foreach (KeyValuePair<string, bool> pair in _testitems.Tests)
      {
        ToolStripMenuItem item = (ToolStripMenuItem)testMenu.DropDownItems.Add(pair.Key, null, new EventHandler(_tests_Clicked));
        item.Checked = true;
        item.CheckOnClick = true;
      }
    }
    private void runButton_Click(object sender, EventArgs e)
    {
      DbProviderFactory factory = DbProviderFactories.GetFactory(_provider.SelectedItem.ToString());
      _test = new TestCases(factory, _connectionString.Text);
      _test.Tests = _testitems.Tests;

      _test.OnTestStarting += new TestStartingEvent(_test_OnTestStarting);
      _test.OnTestFinished += new TestCompletedEvent(_test_OnTestFinished);
      _test.OnAllTestsDone += new EventHandler(_test_OnAllTestsDone);
      _grid.Rows.Clear();
      runButton.Enabled = false;

      System.Threading.Thread t = new System.Threading.Thread(new System.Threading.ThreadStart(_threadFunc));
      t.IsBackground = true;
      t.Start();
    }
Exemple #3
0
        private void runButton_Click(object sender, EventArgs e)
        {
            DbProviderFactory factory = DbProviderFactories.GetFactory(_provider.SelectedItem.ToString());

            _test       = new TestCases(factory, _connectionString.Text);
            _test.Tests = _testitems.Tests;

            _test.OnTestStarting += new TestStartingEvent(_test_OnTestStarting);
            _test.OnTestFinished += new TestCompletedEvent(_test_OnTestFinished);
            _test.OnAllTestsDone += new EventHandler(_test_OnAllTestsDone);
            _grid.Rows.Clear();
            runButton.Enabled = false;

            System.Threading.Thread t = new System.Threading.Thread(new System.Threading.ThreadStart(_threadFunc));
            t.IsBackground = true;
            t.Start();
        }
        static void Main()
        {
            DbConnection cnn;

            SQLiteFunction.RegisterFunction(typeof(TestFunc));
            SQLiteFunction.RegisterFunction(typeof(MyCount));
            SQLiteFunction.RegisterFunction(typeof(MySequence));

            try
            {
                System.IO.File.Delete("test.db3");
            }
            catch
            {
            }

            //SQLiteConnection sqlite_con = new SQLiteConnection(@"data source=""|DataDirectory|donnees.db""");

            //SQLiteDataAdapter sqlite_da = new SQLiteDataAdapter();
            //DataSet dataSet = new DataSet();

            //sqlite_da.SelectCommand = new SQLiteCommand("select * from donnees", sqlite_con);



            //sqlite_con.Open();

            //sqlite_da.Fill(dataSet);

            //sqlite_con.Close();

            using (cnn = new SQLiteConnection())
            {
                TestCases tests = new TestCases();

                cnn.ConnectionString = "Data Source=test.db3;Password=yVXL39etehPX";
                cnn.Open();
                tests.Run(cnn);

                System.Windows.Forms.Application.Run(tests.frm);
            }
        }
Exemple #5
0
    static void Main()
    {
      DbConnection cnn;

      SQLiteFunction.RegisterFunction(typeof(TestFunc));
      SQLiteFunction.RegisterFunction(typeof(MyCount));
      SQLiteFunction.RegisterFunction(typeof(MySequence));

      try
      {
        System.IO.File.Delete("test.db3");
      }
      catch
      {
      }

      //SQLiteConnection sqlite_con = new SQLiteConnection(@"data source=""|DataDirectory|donnees.db""");

      //SQLiteDataAdapter sqlite_da = new SQLiteDataAdapter();
      //DataSet dataSet = new DataSet();

      //sqlite_da.SelectCommand = new SQLiteCommand("select * from donnees", sqlite_con);



      //sqlite_con.Open();

      //sqlite_da.Fill(dataSet);

      //sqlite_con.Close();

      using (cnn = new SQLiteConnection())
      {
        TestCases tests = new TestCases();

        cnn.ConnectionString = "Data Source=test.db3;Password=yVXL39etehPX";
        cnn.Open();
        tests.Run(cnn);

        System.Windows.Forms.Application.Run(tests.frm);
      }
    }
Exemple #6
0
        static void Main(string[] args)
        {
            DbProviderFactory fact;

            fact = DbProviderFactories.GetFactory("System.Data.SQLite");

            System.IO.File.Delete("test.db3");
            using (DbConnection cnn = fact.CreateConnection())
            {
                cnn.ConnectionString = "Data Source=test.db3";
                cnn.Open();

                //cnn.Update += new SQLiteUpdateEventHandler(cnn_Updated);
                //cnn.Commit += new SQLiteCommitHandler(cnn_Commit);
                //cnn.RollBack += new EventHandler(cnn_RollBack);

                TestCases.Run(fact, cnn);
            }

            Console.ReadKey();
        }
        protected void MainPage_Loaded(object sender, EventArgs e)
         {

             //SQLiteClientTests.SQLiteClientTestDriver.Main(null);
             IDbConnection cnn;

             try
             {
                 System.IO.IsolatedStorage.IsolatedStorageFile.GetUserStoreForApplication().DeleteFile("test.db3");
             }
             catch { }


             using (cnn = new SqliteConnection())
             {
                 TestCases tests = new TestCases();

                 cnn.ConnectionString = "data source=test.db3,password=0x01010101010101010101010101010101";
                 cnn.Open();
                 tests.Run(cnn, this);
             }
         }
Exemple #8
0
        public TestCasesDialog(string fileName, bool autoRun)
        {
            InitializeComponent();

            using (DataTable tbl = DbProviderFactories.GetFactoryClasses())
            {
                foreach (DataRow row in tbl.Rows)
                {
                    string prov = row[2].ToString();

                    if (prov.IndexOf("SQLite", 0, StringComparison.OrdinalIgnoreCase) != -1 ||
                        prov.IndexOf("SqlClient", 0, StringComparison.OrdinalIgnoreCase) != -1
                        )
                    {
                        _provider.Items.Add(prov);
                    }
                    if (prov == "System.Data.SQLite")
                    {
                        _provider.SelectedItem = prov;
                    }
                }
            }
            _connectionString.Items.Add(String.Format("Data Source={0};Pooling=true;FailIfMissing=false", fileName));
            _connectionString.Items.Add("Data Source=(local);Initial Catalog=sqlite;Integrated Security=True;Max Pool Size=10");
            _connectionString.SelectedIndex = 0;

            _autoRun   = autoRun;
            _testitems = new TestCases();
            foreach (KeyValuePair <string, bool> pair in _testitems.Tests)
            {
                ToolStripMenuItem item = (ToolStripMenuItem)testMenu.DropDownItems.Add(pair.Key, null, new EventHandler(_tests_Clicked));
                item.Checked      = true;
                item.CheckOnClick = true;
            }

            this.Shown       += new EventHandler(TestCasesDialog_Shown);
            this.FormClosing += new FormClosingEventHandler(TestCasesDialog_FormClosing);
        }
Exemple #9
0
    static int Main(string[] args)
    {
      bool autoClose = false;
      int exitCode = 2; /* INCOMPLETE */
      Assembly assembly = Assembly.GetExecutingAssembly();
      AssemblyName assemblyName = assembly.GetName();
      string directory = Path.GetDirectoryName(assemblyName.CodeBase);

      if (args.Length > 0)
          autoClose = bool.Parse(args[0]);

      try { File.Delete(directory + "\\test.db"); } catch { }

      SQLiteFunction.RegisterFunction(typeof(TestFunc));
      SQLiteFunction.RegisterFunction(typeof(MyCount));
      SQLiteFunction.RegisterFunction(typeof(MySequence));

      using (DbConnection cnn = NewConnection())
      {
        string connectionString = DefaultConnectionString;

        try
        {
          //
          // NOTE: Attempt to open the configuration file associated with
          //       this test executable.  It should contain *EXACTLY* one
          //       line, which will be the connection string to use for
          //       this test run.
          //
          using (StreamReader streamReader = File.OpenText(
              directory + "\\test.cfg"))
          {
            connectionString = streamReader.ReadToEnd().Trim();
          }
        }
        catch
        {
          // do nothing.
        }

        //
        // NOTE: If we are unable to obtain a valid connection string
        //       bail out now.
        //
        if (connectionString != null)
        {
          //
          // NOTE: Replace the "{DataDirectory}" token, if any, in the
          //       connection string with the actual directory this test
          //       assembly is executing from.
          //
          connectionString = connectionString.Replace(
            "{DataDirectory}", directory);

          cnn.ConnectionString = connectionString;
          cnn.Open();

          TestCases tests = new TestCases(connectionString, cnn, autoClose);

          tests.Run();

          Application.Run(tests.frm);

          if (tests.Succeeded())
              exitCode = 0; /* SUCCESS */
          else
              exitCode = 1; /* FAILURE */
        }
      }

      return exitCode;
    }
Exemple #10
0
        static int Main(string[] args)
        {
            bool autoClose = false;
            bool isolatedSql = false;
            int exitCode = 2; /* INCOMPLETE */
            Assembly assembly = Assembly.GetExecutingAssembly();
            AssemblyName assemblyName = assembly.GetName();
            string directory = Path.GetDirectoryName(assemblyName.CodeBase);

            if (args.Length > 0)
            {
                try { autoClose = bool.Parse(args[0]); }
                catch { }
            }

            if (args.Length > 1)
            {
                try { isolatedSql = bool.Parse(args[1]); }
                catch { }
            }

            try { File.Delete(directory + "\\test.db"); }
            catch { }

            SQLiteFunction.RegisterFunction(typeof(TestFunc));
            SQLiteFunction.RegisterFunction(typeof(MyCount));
            SQLiteFunction.RegisterFunction(typeof(MySequence));

            using (DbConnection cnn = NewConnection())
            {
                string connectionString = GetConnectionString(directory);

                //
                // NOTE: If we are unable to obtain a valid connection string
                //       bail out now.
                //
                if (connectionString != null)
                {
                    //
                    // NOTE: Replace the "{DataDirectory}" token, if any, in
                    //       the connection string with the actual directory
                    //       this test assembly is executing from.
                    //
                    connectionString = connectionString.Replace(
                      "{DataDirectory}", directory);

                    cnn.ConnectionString = connectionString;
                    cnn.Open();

                    string sql = GetInitializationSQL(directory);

                    ExecuteInitializationSQL(cnn, sql, isolatedSql);

                    TestCases tests = new TestCases(
                        connectionString, cnn, sql, autoClose, isolatedSql);

                    tests.Run();

                    Application.Run(tests.frm);

                    if (tests.Succeeded())
                        exitCode = 0; /* SUCCESS */
                    else
                        exitCode = 1; /* FAILURE */
                }
            }

            return exitCode;
        }
Exemple #11
0
        static int Main(string[] args)
        {
            bool         autoClose    = false;
            int          exitCode     = 2; /* INCOMPLETE */
            Assembly     assembly     = Assembly.GetExecutingAssembly();
            AssemblyName assemblyName = assembly.GetName();
            string       directory    = Path.GetDirectoryName(assemblyName.CodeBase);

            if (args.Length > 0)
            {
                autoClose = bool.Parse(args[0]);
            }

            try { File.Delete(directory + "\\test.db"); } catch { }

            SQLiteFunction.RegisterFunction(typeof(TestFunc));
            SQLiteFunction.RegisterFunction(typeof(MyCount));
            SQLiteFunction.RegisterFunction(typeof(MySequence));

            using (DbConnection cnn = NewConnection())
            {
                string connectionString = DefaultConnectionString;

                try
                {
                    //
                    // NOTE: Attempt to open the configuration file associated with
                    //       this test executable.  It should contain *EXACTLY* one
                    //       line, which will be the connection string to use for
                    //       this test run.
                    //
                    using (StreamReader streamReader = File.OpenText(
                               directory + "\\test.cfg"))
                    {
                        connectionString = streamReader.ReadToEnd().Trim();
                    }
                }
                catch
                {
                    // do nothing.
                }

                //
                // NOTE: If we are unable to obtain a valid connection string
                //       bail out now.
                //
                if (connectionString != null)
                {
                    //
                    // NOTE: Replace the "{DataDirectory}" token, if any, in the
                    //       connection string with the actual directory this test
                    //       assembly is executing from.
                    //
                    connectionString = connectionString.Replace(
                        "{DataDirectory}", directory);

                    cnn.ConnectionString = connectionString;
                    cnn.Open();

                    TestCases tests = new TestCases(connectionString, cnn, autoClose);

                    tests.Run();

                    Application.Run(tests.frm);

                    if (tests.Succeeded())
                    {
                        exitCode = 0; /* SUCCESS */
                    }
                    else
                    {
                        exitCode = 1; /* FAILURE */
                    }
                }
            }

            return(exitCode);
        }
        static int Main(string[] args)
        {
            bool         autoClose    = false;
            bool         isolatedSql  = false;
            int          exitCode     = 2; /* INCOMPLETE */
            Assembly     assembly     = Assembly.GetExecutingAssembly();
            AssemblyName assemblyName = assembly.GetName();
            string       directory    = Path.GetDirectoryName(assemblyName.CodeBase);

            if (args.Length > 0)
            {
                try { autoClose = bool.Parse(args[0]); }
                catch { }
            }

            if (args.Length > 1)
            {
                try { isolatedSql = bool.Parse(args[1]); }
                catch { }
            }

            try { File.Delete(directory + "\\test.db"); }
            catch { }

            SQLiteFunction.RegisterFunction(typeof(TestFunc));
            SQLiteFunction.RegisterFunction(typeof(MyCount));
            SQLiteFunction.RegisterFunction(typeof(MySequence));

            using (DbConnection cnn = NewConnection())
            {
                string connectionString = GetConnectionString(directory);

                //
                // NOTE: If we are unable to obtain a valid connection string
                //       bail out now.
                //
                if (connectionString != null)
                {
                    //
                    // NOTE: Replace the "{DataDirectory}" token, if any, in
                    //       the connection string with the actual directory
                    //       this test assembly is executing from.
                    //
                    connectionString = connectionString.Replace(
                        "{DataDirectory}", directory);

                    cnn.ConnectionString = connectionString;
                    cnn.Open();

                    string sql = GetInitializationSQL(directory);

                    ExecuteInitializationSQL(cnn, sql, isolatedSql);

                    TestCases tests = new TestCases(
                        connectionString, cnn, sql, autoClose, isolatedSql);

                    tests.Run();

                    Application.Run(tests.frm);

                    if (tests.Succeeded())
                    {
                        exitCode = 0; /* SUCCESS */
                    }
                    else
                    {
                        exitCode = 1; /* FAILURE */
                    }
                }
            }

            return(exitCode);
        }