コード例 #1
0
        public void AddTrigger_WithValidDatabasePath_AddsTriggerToSpecifiedDatabase()
        {
            MainTreeHandler.AddTrigger("NewTrigger", DATABASEPATH1);

            var result = TreeSearcher.DatabaseHoldsItem <TriggerFolderItem>(testTree, "NewTrigger", DATABASEPATH1);

            Assert.IsTrue(result);
        }
コード例 #2
0
        public void AddTrigger_WithValidDatabasePath_DoesNotAddTriggerToDifferentDatabase()
        {
            MainTreeHandler.AddTrigger("NewTrigger", DATABASEPATH1);

            var result = TreeSearcher.DatabaseHoldsItem <TriggerFolderItem>(testTree, "NewTrigger", DATABASEPATH2);

            Assert.IsFalse(result);
        }
コード例 #3
0
        private void Create()
        {
            StatusInfo = string.Empty;

            using (var dbHandler = new DatabaseHandler(selectedDatabase.DatabasePath))
            {
                try
                {
                    dbHandler.ExecuteNonQuery(sql);
                    StatusInfo = LocalisationHelper.GetString("TriggerCreator_StatusInfo_Success");
                    MainTreeHandler.AddTrigger(triggerName, selectedDatabase.DatabasePath);
                }
                catch (Exception ex)
                {
                    logger.Error("An error occured when the user tried to create a trigger from the TriggerCreator.", ex);
                    StatusInfo = ex.Message.Replace("SQL logic error or missing database\r\n", "SQL-Error - ");
                }
            }
        }
コード例 #4
0
 public void AddTrigger_WithInvalidDatabasePath_DoesNotThrowException()
 {
     Assert.DoesNotThrow(
         () => MainTreeHandler.AddTrigger("NewTrigger", "InvalidPath"));
 }