Exemplo n.º 1
0
        public void TestCreateBatchAndSave()
        {
            TFrmGLBatch frmBatch = new TFrmGLBatch(null);

            frmBatch.LedgerNumber = FLedgerNumber;
            frmBatch.Show();

            ToolStripButtonTester btnSave = new ToolStripButtonTester("tbbSave");
            ButtonTester btnNewBatch = new ButtonTester("ucoBatches.btnNew");

            Assert.AreEqual(false, btnSave.Properties.Enabled, "Save button should be disabled since there are no changes");
            btnNewBatch.Click();

            TextBoxTester txtDetailBatchDescription = new TextBoxTester("txtDetailBatchDescription");
            txtDetailBatchDescription.Properties.Text = "Created by test TestCreateBatchAndSave";

            Assert.AreEqual(true, btnSave.Properties.Enabled, "Save button should be enabled since there was a change");
            btnSave.Click();
        }
Exemplo n.º 2
0
//        /// <summary>
//        /// simple test to create a batch and save it
//        /// </summary>
//        [Test]
//        public void TestCreateBatchAndSave()
//        {
//            TFrmGiftBatch frmBatch = new TFrmGiftBatch(IntPtr.Zero);
//
//            frmBatch.LedgerNumber = FLedgerNumber;
//            frmBatch.Show();
//
//            ToolStripButtonTester btnSave = new ToolStripButtonTester("tbbSave");
//            ButtonTester btnNewBatch = new ButtonTester("ucoBatches.btnNew");
//
//            Assert.AreEqual(false, btnSave.Properties.Enabled, "Save button should be disabled since there are no changes");
//            btnNewBatch.Click();
//
//            TextBoxTester txtDetailBatchDescription = new TextBoxTester("txtDetailBatchDescription");
//            txtDetailBatchDescription.Properties.Text = "Created by test TestCreateBatchAndSave";
//
//            Assert.AreEqual(true, btnSave.Properties.Enabled, "Save button should be enabled since there was a change");
//            btnSave.Click();
//        }

        private void ImportGiftBatch(string TestFile)
        {
            TestFile = Path.GetFullPath(TestFile);
            Assert.IsTrue(File.Exists(TestFile), "File does not exist: " + TestFile);

            ModalFormHandler = delegate(string name, IntPtr hWnd, Form form)
            {
                OpenFileDialogTester tester = new OpenFileDialogTester(hWnd);

                ModalFormHandler = delegate(string name2, IntPtr hWnd2, Form form2)
                {
                    TDlgSelectCSVSeparatorTester tester2 = new TDlgSelectCSVSeparatorTester(hWnd2);
                    TextBoxTester txtDateFormat = new TextBoxTester("txtDateFormat");
                    txtDateFormat.Properties.Text = "MM/dd/yyyy";
                    RadioButtonTester rbtSemicolon = new RadioButtonTester("rbtSemicolon");
                    rbtSemicolon.Properties.Checked = true;
                    ComboBoxTester cmbNumberFormat = new ComboBoxTester("cmbNumberFormat");
                    cmbNumberFormat.Select(0);
                    ButtonTester btnOK = new ButtonTester("btnOK", tester2.Properties.Name);
                    ModalFormHandler = delegate(string name3, IntPtr hWnd3, Form form3)
                    {
                        MessageBoxTester tester3 = new MessageBoxTester(hWnd3);
                        Assert.AreEqual("Success", tester3.Title);
                        tester3.SendCommand(MessageBoxTester.Command.OK);
                    };
                    btnOK.Click();
                };
                tester.OpenFile(TestFile);
            };

            ToolStripButtonTester btnImport = new ToolStripButtonTester("tbbImportBatches");

            btnImport.Click();
        }
Exemplo n.º 3
0
        public void SaveAndCancel()
        {
            FMainDS.LoadAll();
            FMainDS.DeleteAllRows();
            FMainDS.SaveChanges();

            TFrmSetupCorporateExchangeRate mainScreen = new TFrmSetupCorporateExchangeRate(null);
            mainScreen.Show();

            // Save and New buttons
            ToolStripButtonTester btnSave = new ToolStripButtonTester("tbbSave", mainScreen);
            ButtonTester btnNew = new ButtonTester("btnNew", mainScreen);
            TTxtNumericTextBox txtExchangeRate = (new TTxtNumericTextBoxTester("txtDetailRateOfExchange", mainScreen)).Properties;

            // Add new row, save and close
            btnNew.Click();
            txtExchangeRate.NumberValueDecimal = 10m;
            btnSave.Click();
            mainScreen.Close();

            // Create the screen a second time
            TFrmSetupCorporateExchangeRate mainScreen2 = new TFrmSetupCorporateExchangeRate(null);
            mainScreen2.Show();

            // make sure the data really got saved
            TSgrdDataGrid grdDetails = (TSgrdDataGrid)(new TSgrdDataGridPagedTester("grdDetails", mainScreen2).Properties);
            Assert.AreEqual(3, grdDetails.Rows.Count);

            btnNew = new ButtonTester("btnNew", mainScreen2);
            txtExchangeRate = (new TTxtNumericTextBoxTester("txtDetailRateOfExchange", mainScreen2)).Properties;

            // Add another row, but this time close without saving
            btnNew.Click();

            ModalFormHandler = delegate(string name, IntPtr hWnd, Form form)
            {
                MessageBoxTester tester = new MessageBoxTester(hWnd);
                tester.SendCommand(MessageBoxTester.Command.No);
            };

            mainScreen2.Close();

            // Create the screen a third time
            TFrmSetupCorporateExchangeRate mainScreen3 = new TFrmSetupCorporateExchangeRate(null);
            mainScreen3.Show();

            // make sure the data did not get saved
            grdDetails = (TSgrdDataGrid)(new TSgrdDataGridPagedTester("grdDetails", mainScreen3).Properties);
            Assert.AreEqual(3, grdDetails.Rows.Count);

            btnNew = new ButtonTester("btnNew", mainScreen3);
            txtExchangeRate = (new TTxtNumericTextBoxTester("txtDetailRateOfExchange", mainScreen3)).Properties;

            // Add another row, but this time close AND save
            btnNew.Click();

            ModalFormHandler = delegate(string name, IntPtr hWnd, Form form)
            {
                MessageBoxTester tester = new MessageBoxTester(hWnd);
                tester.SendCommand(MessageBoxTester.Command.Yes);
            };

            mainScreen3.Close();

            // Create the screen a fourth time!
            TFrmSetupCorporateExchangeRate mainScreen4 = new TFrmSetupCorporateExchangeRate(null);
            mainScreen4.Show();

            // make sure the data was saved last time
            grdDetails = (TSgrdDataGrid)(new TSgrdDataGridPagedTester("grdDetails", mainScreen4).Properties);
            Assert.AreEqual(5, grdDetails.Rows.Count);

            mainScreen4.Close();
        }
Exemplo n.º 4
0
        public void TestCancelBatchBug121()
        {
            TFrmGLBatch frmBatch = new TFrmGLBatch(null);

            frmBatch.LedgerNumber = FLedgerNumber;
            frmBatch.Show();

            // create a new batch and save
            ToolStripButtonTester btnSave = new ToolStripButtonTester("tbbSave");
            ButtonTester btnNewBatch = new ButtonTester("ucoBatches.btnNew");
            btnNewBatch.Click();
            TextBoxTester txtDetailBatchDescription = new TextBoxTester("txtDetailBatchDescription");
            txtDetailBatchDescription.Properties.Text = "Created by test TestCancelBatchBug121";
            btnSave.Click();

            // cancel that batch. no saving necessary
            ButtonTester btnCancelBatch = new ButtonTester("ucoBatches.btnCancel");
            ModalFormHandler = delegate(string name, IntPtr hWnd, Form form)
            {
                MessageBoxTester tester = new MessageBoxTester(hWnd);
                Assert.AreEqual("Form Contains Invalid Data", tester.Title);

                // there is a second message box after confirming the cancellation, telling the user the cancellation was successful.
                // because the ModalFormHandler is reset after handling the first message box, we need to set up a new handler.
                ModalFormHandler = delegate(string name2, IntPtr hWnd2, Form form2)
                {
                    MessageBoxTester tester2 = new MessageBoxTester(hWnd2);
                    // Assert.AreEqual("Success", tester.Title);
                    tester2.SendCommand(MessageBoxTester.Command.Yes);
                };

                tester.SendCommand(MessageBoxTester.Command.Yes);
            };

            btnCancelBatch.Click();

            // add a new batch
            btnNewBatch.Click();
            txtDetailBatchDescription.Properties.Text = "Created by test TestCancelBatchBug121, not cancelled";

            // save: the bug caused exception "Forgot to call AcceptChanges"
            btnSave.Click();

            Assert.AreEqual(false, btnSave.Properties.Enabled, "Save button should be disabled because all changes have been saved");
        }
Exemplo n.º 5
0
        public void TestAnalysisAttributes()
        {
            // At the moment the initial state is unknown so we make a relative test


            TFrmSetupAnalysisTypes frmAnalysistypes = new TFrmSetupAnalysisTypes(null);

            frmAnalysistypes.LedgerNumber = FLedgerNumber;
            frmAnalysistypes.Show();
            // Tests schould be repeateable but at the moment we make only a relative test

            // Press the new Button for the types
            String randomNewValueString = RandomString();
            ButtonTester btnNewType = new ButtonTester("btnNewType");
            btnNewType.Click();

            TextBoxTester txtDetailAnalysisTypeCode = new TextBoxTester("txtDetailAnalysisTypeCode");
            txtDetailAnalysisTypeCode.Properties.Text = randomNewValueString;
            TextBoxTester txtDetailAnalysisTypeDescription = new TextBoxTester("txtDetailAnalysisTypeDescription");
            txtDetailAnalysisTypeDescription.Properties.Text = "Description for " + randomNewValueString;

            // Press the new Button for the values
            ButtonTester btnNewValue = new ButtonTester("btnNew");
            btnNewValue.Click();

            TextBoxTester txtDetailAnalysisValue = new TextBoxTester("txtDetailAnalysisValue");
            txtDetailAnalysisValue.Properties.Text = randomNewValueString + "-1";
            btnNewValue.Click();

            txtDetailAnalysisValue.Properties.Text = randomNewValueString + "-2";
            CheckBoxTester chkDetailActive = new CheckBoxTester("chkDetailActive");
            Assert.IsTrue(chkDetailActive.Checked, "Active not set as default!");
            chkDetailActive.Properties.Checked = false;


            ToolStripButtonTester btnSave = new ToolStripButtonTester("tbbSave");
            // and save everything
            btnSave.Click();
            // Press the delete Button for the values
            ButtonTester btnDeleteValue = new ButtonTester("btnDelete");
            ModalFormHandler = delegate(string name, IntPtr hWnd, Form form)
            {
                MessageBoxTester tester = new MessageBoxTester(hWnd);
                Assert.AreEqual("Confirm Delete", tester.Title);
                tester.SendCommand(MessageBoxTester.Command.Yes);
            };
            btnDeleteValue.Click();

            ModalFormHandler = delegate(string name, IntPtr hWnd, Form form)
            {
                MessageBoxTester tester = new MessageBoxTester(hWnd);
                Assert.AreEqual("Confirm Delete", tester.Title);
                tester.SendCommand(MessageBoxTester.Command.Yes);
            };
            btnDeleteValue.Click();
            // Press the delete Button for the types
            ButtonTester btnDeleteType = new ButtonTester("btnDeleteType");
            ModalFormHandler = delegate(string name, IntPtr hWnd, Form form)
            {
                MessageBoxTester tester = new MessageBoxTester(hWnd);
                Assert.AreEqual("Confirm Delete", tester.Title);
                tester.SendCommand(MessageBoxTester.Command.Yes);
            };
            btnDeleteType.Click();
            btnSave.Click();
        }
Exemplo n.º 6
0
        public void TestImportExportGLBatch()
        {
            // create two test batches, with some strange figures, to test problem with double values
            // export the 2 test batches, with summarize option
            // compare the exported text file

            string TestFile = TAppSettingsManager.GetValue("Testing.Path") + "/MFinance/GLForm/TestData/BatchImportFloatTest.csv";

            TestFile = Path.GetFullPath(TestFile);
            Assert.IsTrue(File.Exists(TestFile), "File does not exist: " + TestFile);

            TFrmGLBatch frmBatch = new TFrmGLBatch(null);

            frmBatch.LedgerNumber = FLedgerNumber;
            frmBatch.Show();

            ModalFormHandler = delegate(string name, IntPtr hWnd, Form form)
            {
                OpenFileDialogTester tester = new OpenFileDialogTester(hWnd);

                ModalFormHandler = delegate(string name2, IntPtr hWnd2, Form form2)
                {
                    TDlgSelectCSVSeparatorTester tester2 = new TDlgSelectCSVSeparatorTester(hWnd2);
                    TextBoxTester txtDateFormat = new TextBoxTester("txtDateFormat");
                    txtDateFormat.Properties.Text = "MM/dd/yyyy";
                    RadioButtonTester rbtSemicolon = new RadioButtonTester("rbtSemicolon");
                    rbtSemicolon.Properties.Checked = true;

                    ButtonTester btnOK = new ButtonTester("btnOK", tester2.Properties.Name);
                    btnOK.Click();
                };

                tester.OpenFile(TestFile);
            };

            ToolStripButtonTester btnImport = new ToolStripButtonTester("tbbImportBatches");
            btnImport.Click();

            ToolStripButtonTester btnSave = new ToolStripButtonTester("tbbSave");
            Assert.IsTrue(btnSave.Properties.Enabled, "Save button has not been activated");
            btnSave.Click();

            // go to Journal tab
            TabControlTester tabGLBatch = new TabControlTester("tabGLBatch");
            tabGLBatch.SelectTab(1);
            TextBoxTester txtBatchNumber = new TextBoxTester("ucoJournals.txtBatchNumber");

            // get the batch number from the journal tab
            int ImportedBatchNumber = Convert.ToInt32(txtBatchNumber.Properties.Text);

            TFrmGLBatchExport frmBatchExport = new TFrmGLBatchExport(null);

            frmBatch.Close();

            // export that batch, summarize the transactions
            // compare the result with the expected file
            frmBatchExport.LedgerNumber = FLedgerNumber;
            frmBatchExport.Show();

            CheckBoxTester chkIncludeUnposted = new CheckBoxTester("chkIncludeUnposted");
            chkIncludeUnposted.Properties.Checked = true;

            RadioButtonTester rbtSummary = new RadioButtonTester("rbtSummary");
            rbtSummary.Properties.Checked = false;

            RadioButtonTester rbtBatchNumberSelection = new RadioButtonTester("rbtBatchNumberSelection");
            rbtBatchNumberSelection.Properties.Checked = true;

            TextBoxTester txtFilename = new TextBoxTester("txtFilename");

            ToolStripButtonTester tbbExportBatches = new ToolStripButtonTester("tbbExportBatches");

            TTxtNumericTextBoxTester txtBatchNumberStart = new TTxtNumericTextBoxTester("txtBatchNumberStart");
            txtBatchNumberStart.Properties.NumberValueInt = ImportedBatchNumber;
            TTxtNumericTextBoxTester txtBatchNumberEnd = new TTxtNumericTextBoxTester("txtBatchNumberEnd");
            txtBatchNumberEnd.Properties.NumberValueInt = ImportedBatchNumber;

            // Test simple export of batches, no summary
            TestFile = TAppSettingsManager.GetValue("Testing.Path") + "/MFinance/GLForm/TestData/BatchExportFloatTest.csv";
            TestFile = Path.GetFullPath(TestFile);
            Assert.IsTrue(File.Exists(TestFile), "File does not exist: " + TestFile);
            txtFilename.Properties.Text = TestFile + ".new";

            ModalFormHandler = delegate(string name2, IntPtr hWnd2, Form form2)
            {
                MessageBoxTester tester2 = new MessageBoxTester(hWnd2);
                // Assert.AreEqual("Success", tester.Title);
                tester2.SendCommand(MessageBoxTester.Command.OK);
            };

            tbbExportBatches.Click();

            Assert.AreEqual(true, TTextFile.SameContent(TestFile,
                    TestFile + ".new"), "the files should be the same: " + TestFile);
            System.IO.File.Delete(TestFile + ".new");

            // Test export of batches, summarizing the transactions
            TestFile = TAppSettingsManager.GetValue("Testing.Path") + "/MFinance/GLForm/TestData/BatchExportFloatTestSummary.csv";
            TestFile = Path.GetFullPath(TestFile);
            Assert.IsTrue(File.Exists(TestFile), "File does not exist: " + TestFile);
            txtFilename.Properties.Text = TestFile + ".new";
            rbtSummary.Properties.Checked = true;

            ModalFormHandler = delegate(string name2, IntPtr hWnd2, Form form2)
            {
                MessageBoxTester tester2 = new MessageBoxTester(hWnd2);
                // Assert.AreEqual("Success", tester.Title);
                tester2.SendCommand(MessageBoxTester.Command.OK);
            };

            tbbExportBatches.Click();

            Assert.AreEqual(true, TTextFile.SameContent(TestFile,
                    TestFile + ".new"), "the files should be the same: " + TestFile);
            System.IO.File.Delete(TestFile + ".new");

            frmBatchExport.Close();
        }
Exemplo n.º 7
0
        public void TestImportGLTransactions()
        {
            // create a test batch and journal and then import transactions

            string TestFile = TAppSettingsManager.GetValue("Testing.Path") + "/MFinance/GLForm/TestData/TransactionsImport.csv";

            TestFile = Path.GetFullPath(TestFile);
            Assert.IsTrue(File.Exists(TestFile), "File does not exist: " + TestFile);

            TFrmGLBatch frmBatch = new TFrmGLBatch(null);

            frmBatch.LedgerNumber = FLedgerNumber;
            frmBatch.Show();

            // create a new batch and save
            ButtonTester btnNewBatch = new ButtonTester("ucoBatches.btnNew");
            btnNewBatch.Click();
            TextBoxTester txtDetailBatchDescription = new TextBoxTester("txtDetailBatchDescription");
            txtDetailBatchDescription.Properties.Text = "Created by test TestImportGLTransactions";

            TabControlTester tabGLBatch = new TabControlTester("tabGLBatch");

            // go to Journal tab
            tabGLBatch.SelectTab(1);

            ButtonTester btnNewJournal = new ButtonTester("ucoJournals.btnAdd");
            btnNewJournal.Click();

            // go to transaction tab
            tabGLBatch.SelectTab(2);

            ModalFormHandler = delegate(string name, IntPtr hWnd, Form form)
            {
                OpenFileDialogTester tester = new OpenFileDialogTester(hWnd);

                ModalFormHandler = delegate(string name2, IntPtr hWnd2, Form form2)
                {
                    TDlgSelectCSVSeparatorTester tester2 = new TDlgSelectCSVSeparatorTester(hWnd2);
                    TextBoxTester txtDateFormat = new TextBoxTester("txtDateFormat");
                    txtDateFormat.Properties.Text = "dd/MM/yyyy";
                    RadioButtonTester rbtSemicolon = new RadioButtonTester("rbtSemicolon");
                    rbtSemicolon.Properties.Checked = true;

                    ButtonTester btnOK = new ButtonTester("btnOK", tester2.Properties.Name);
                    btnOK.Click();
                };

                tester.OpenFile(TestFile);
            };

            ToolStripButtonTester btnImport = new ToolStripButtonTester("tbbImportTransactions");
            btnImport.Click();

            TSgrdDataGridPagedTester grdDetails = new TSgrdDataGridPagedTester("grdDetails");
            Assert.AreNotEqual(1, grdDetails.Count, "The grid should be populated");
        }
Exemplo n.º 8
0
        public void TestCreateBatchAndPost()
        {
            TFrmGLBatch frmBatch = new TFrmGLBatch(null);

            frmBatch.LedgerNumber = FLedgerNumber;
            frmBatch.Show();

            // create a new batch and save
            ButtonTester btnNewBatch = new ButtonTester("ucoBatches.btnNew");
            btnNewBatch.Click();
            TextBoxTester txtDetailBatchDescription = new TextBoxTester("txtDetailBatchDescription");
            txtDetailBatchDescription.Properties.Text = "Created by test TestExportGLBatch";

            TabControlTester tabGLBatch = new TabControlTester("tabGLBatch");

            // go to Journal tab
            tabGLBatch.SelectTab(1);

            ButtonTester btnNewJournal = new ButtonTester("ucoJournals.btnAdd");
            btnNewJournal.Click();

            // go to transaction tab
            tabGLBatch.SelectTab(2);

            ButtonTester btnNewTransaction = new ButtonTester("ucoTransactions.btnNew");
            btnNewTransaction.Click();

            TextBoxTester txtDetailNarrative = new TextBoxTester("txtDetailNarrative");
            txtDetailNarrative.Properties.Text = "test";
            TextBoxTester txtDetailReference = new TextBoxTester("txtDetailReference");
            txtDetailReference.Properties.Text = "test";

            TTxtCurrencyTextBoxTester txtDebitAmount = new TTxtCurrencyTextBoxTester("txtDebitAmount");
            txtDebitAmount.Properties.Focus();
            decimal Amount = 1111.44M;
            txtDebitAmount.Properties.NumberValueDecimal = Amount;

            TCmbAutoPopulatedTester cmbDetailAccountCode = new TCmbAutoPopulatedTester("cmbDetailAccountCode");
            cmbDetailAccountCode.Properties.SetSelectedString("6000");

            TCmbAutoPopulatedTester cmbDetailCostCentreCode = new TCmbAutoPopulatedTester("cmbDetailCostCentreCode");
            cmbDetailCostCentreCode.Properties.SetSelectedString(FLedgerNumber.ToString("00") + "00");

            btnNewTransaction.Click();
            txtDetailNarrative.Properties.Text = "test";
            txtDetailReference.Properties.Text = "test";
            TTxtCurrencyTextBoxTester txtCreditAmount = new TTxtCurrencyTextBoxTester("txtCreditAmount");
            txtDebitAmount.Properties.NumberValueDecimal = 0;
            txtCreditAmount.Properties.Focus();
            txtCreditAmount.Properties.NumberValueDecimal = Amount;

            cmbDetailAccountCode.Properties.Focus();        // This will update the totals
            cmbDetailAccountCode.Properties.SetSelectedString("0200");
            cmbDetailCostCentreCode.Properties.SetSelectedString(FLedgerNumber.ToString("00") + "00");

            ToolStripButtonTester btnSave = new ToolStripButtonTester("tbbSave");
            btnSave.Click();

            // go to Batch tab
            tabGLBatch.SelectTab(0);

            // post this batch
            ModalFormHandler = delegate(string name, IntPtr hWnd, Form form)
            {
                MessageBoxTester tester = new MessageBoxTester(hWnd);
                Assert.IsTrue(tester.Text.StartsWith(
                        "Are you sure you want to post batch"),
                    "Should start with 'are you sure you want to post batch', but is '" +
                    tester.Text + "'");

                // there is a second message box after posting, telling the user about success.
                // because the ModalFormHandler is reset after handling the first message box, we need to set up a new handler.
                ModalFormHandler = delegate(string name2, IntPtr hWnd2, Form form2)
                {
                    MessageBoxTester tester2 = new MessageBoxTester(hWnd2);
                    Assert.AreEqual("Success", tester2.Title);

                    tester2.SendCommand(MessageBoxTester.Command.Yes);
                };

                tester.SendCommand(MessageBoxTester.Command.Yes);
            };

            ButtonTester btnPost = new ButtonTester("ucoBatches.btnPostBatch");
            btnPost.Click();

            // and now try to create a new batch, bug https://sourceforge.net/apps/mantisbt/openpetraorg/view.php?id=1058
            btnNewBatch.Click();
            btnSave.Click();
        }
//        public ToolStripMenuItemTester mniFile;
//        public System.Windows.Forms.ToolStripMenuItem mniFileSave;
//        public System.Windows.Forms.ToolStripSeparator mniSeparator0;
//        public System.Windows.Forms.ToolStripMenuItem mniFilePrint;
//        public System.Windows.Forms.ToolStripSeparator mniSeparator1;
//        public System.Windows.Forms.ToolStripMenuItem mniClose;
//        public System.Windows.Forms.ToolStripMenuItem mniEdit;
//        public System.Windows.Forms.ToolStripMenuItem mniEditUndoCurrentField;
//        public System.Windows.Forms.ToolStripMenuItem mniEditUndoScreen;
//        public System.Windows.Forms.ToolStripSeparator mniSeparator2;
//        public System.Windows.Forms.ToolStripMenuItem mniEditFind;
//        public System.Windows.Forms.ToolStripMenuItem mniAccounts;
//        public System.Windows.Forms.ToolStripMenuItem mniAddNewAccount;
//        public System.Windows.Forms.ToolStripMenuItem mniDeleteUnusedAccount;
//        public System.Windows.Forms.ToolStripSeparator mniSeparator3;
//        public System.Windows.Forms.ToolStripMenuItem mniExportHierarchy;
//        public System.Windows.Forms.ToolStripMenuItem mniImportHierarchy;
//        public System.Windows.Forms.ToolStripMenuItem mniHelp;
//        public System.Windows.Forms.ToolStripMenuItem mniHelpPetraHelp;
//        public System.Windows.Forms.ToolStripSeparator mniSeparator4;
//        public System.Windows.Forms.ToolStripMenuItem mniHelpBugReport;
//        public System.Windows.Forms.ToolStripSeparator mniSeparator5;
//        public System.Windows.Forms.ToolStripMenuItem mniHelpAboutPetra;
//        public System.Windows.Forms.ToolStripMenuItem mniHelpDevelopmentTeam;


        // Contructor which initializes the acces to all the controls on the
        // Dialog
        /// <summary>
        /// ...
        /// </summary>
        public TFrmGLAccountHierarchyTester()
        {
            mainForm = new TFrmGLAccountHierarchy(null);

            trvAccounts = new TTrvTreeViewTester("trvAccounts", mainForm);
            txtDetailAccountCode = new TextBoxTester("txtDetailAccountCode", mainForm);
            cmbDetailAccountType = new TCmbAutoCompleteTester("cmbDetailAccountType", mainForm);
            txtDetailEngAccountCodeLongDesc = new TextBoxTester("txtDetailEngAccountCodeLongDesc", mainForm);
            txtDetailEngAccountCodeShortDesc = new TextBoxTester("txtDetailEngAccountCodeShortDesc", mainForm);

            txtDetailAccountCodeLongDesc = new TextBoxTester("txtDetailAccountCodeLongDesc", mainForm);
            txtDetailAccountCodeShortDesc = new TextBoxTester("txtDetailAccountCodeShortDesc", mainForm);

            cmbDetailValidCcCombo = new TCmbAutoCompleteTester("cmbDetailValidCcCombo", mainForm);
            chkDetailBankAccountFlag = new CheckBoxTester("chkDetailBankAccountFlag", mainForm);
            chkDetailAccountActiveFlag = new CheckBoxTester("chkDetailAccountActiveFlag", mainForm);

            tbbSave = new ToolStripButtonTester("tbbSave", mainForm);
            tbbAddNewAccount = new ToolStripButtonTester("tbbAddNewAccount", mainForm);
            tbbDeleteUnusedAccount = new ToolStripButtonTester("tbbDeleteUnusedAccount", mainForm);
            tbbExportHierarchy = new ToolStripButtonTester("tbbExportHierarchy", mainForm);
            tbbImportHierarchy = new ToolStripButtonTester("tbbImportHierarchy", mainForm);

            chkDetailForeignCurrencyFlag = new CheckBoxTester("chkDetailForeignCurrencyFlag", mainForm);
            cmbDetailForeignCurrencyCode = new TCmbAutoPopulatedTester("cmbDetailForeignCurrencyCode", mainForm);


            mniClose = new ToolStripMenuItemTester("mniClose", mainForm);
        }
Exemplo n.º 10
0
		private void ClickToolStripButton(string name)
		{
			ToolStripButtonTester tester = new ToolStripButtonTester(name, _window);
			tester.Click();
		}
Exemplo n.º 11
0
        public void DeleteRows()
        {
            FMainDS.LoadAll();
            FMainDS.DeleteAllRows();
            FMainDS.InsertStandardRows();
            FMainDS.SaveChanges();

            TFrmSetupDailyExchangeRate mainScreen = new TFrmSetupDailyExchangeRate(null);
            mainScreen.Show();
            mainScreen.ShowUnusedRates();

            // Toolstrip
            ToolStripButtonTester btnSaveTester = new ToolStripButtonTester("tbbSave", mainScreen);
            ButtonWithFocusTester btnNewTester = new ButtonWithFocusTester("btnNew", mainScreen);
            ButtonWithFocusTester btnDeleteTester = new ButtonWithFocusTester("btnDelete", mainScreen);
            //ButtonWithFocusTester btnEnableEdit = new ButtonWithFocusTester("btnEnableEdit", mainScreen);
            TSgrdDataGridPagedTester grdTester = new TSgrdDataGridPagedTester("grdDetails", mainScreen);
            TSgrdDataGrid grdDetails = (TSgrdDataGrid)grdTester.Properties;
            TTxtNumericTextBox txtExchangeRate = (new TTxtNumericTextBoxTester("txtDetailRateOfExchange", mainScreen)).Properties;
            TtxtPetraDate txtDateEffective = (new TTxtPetraDateTester("dtpDetailDateEffectiveFrom", mainScreen)).Properties;
            TCmbAutoPopulated cmbFromCurrency = (new TCmbAutoPopulatedTester("cmbDetailFromCurrencyCode", mainScreen)).Properties;
            TCmbAutoPopulated cmbToCurrency = (new TCmbAutoPopulatedTester("cmbDetailToCurrencyCode", mainScreen)).Properties;

            // All rows in grid should be deletable because they are unused
            Assert.AreEqual(9, grdDetails.Rows.Count);
            Assert.IsTrue(btnDeleteTester.Properties.Enabled);
            Assert.IsTrue(txtDateEffective.Date.Value.Year < 1910 || txtDateEffective.Date.Value.Year > 2980);

            // Create 3 new rows
            btnNewTester.Click();
            btnNewTester.Click();
            btnNewTester.Click();

            Assert.AreEqual(12, grdDetails.Rows.Count);
            Assert.AreEqual(3, mainScreen.GetSelectedRowIndex());

            // New rows should be deletable
            Assert.IsTrue(btnDeleteTester.Properties.Enabled);
            ModalFormHandler = delegate(string name, IntPtr hWnd, Form form)
            {
                MessageBoxTester tester = new MessageBoxTester(hWnd);
                tester.SendCommand(MessageBoxTester.Command.Yes);
            };
            btnDeleteTester.Click();
            Assert.IsTrue(btnDeleteTester.Properties.Enabled);
            ModalFormHandler = delegate(string name, IntPtr hWnd, Form form)
            {
                MessageBoxTester tester = new MessageBoxTester(hWnd);
                tester.SendCommand(MessageBoxTester.Command.Yes);
            };
            btnDeleteTester.Click();
            Assert.IsTrue(btnDeleteTester.Properties.Enabled);
            ModalFormHandler = delegate(string name, IntPtr hWnd, Form form)
            {
                MessageBoxTester tester = new MessageBoxTester(hWnd);
                tester.SendCommand(MessageBoxTester.Command.Yes);
            };
            btnDeleteTester.Click();

            Assert.IsFalse(cmbFromCurrency.Enabled);
            Assert.IsFalse(cmbToCurrency.Enabled);
            Assert.IsFalse(txtDateEffective.Enabled);
            Assert.IsTrue(txtDateEffective.Date.Value.Year < 1910 || txtDateEffective.Date.Value.Year > 2980);

            Assert.AreEqual(3, mainScreen.GetSelectedRowIndex());

            // Now we should be back to being able to delete a unused row
            Assert.IsTrue(btnDeleteTester.Properties.Enabled);
            Assert.AreEqual(9, grdDetails.Rows.Count);
            Assert.IsTrue(txtDateEffective.Date.Value.Year < 1910 || txtDateEffective.Date.Value.Year > 2980);

            // Activate deletion of saved rows
            //btnEnableEdit.Click();
            Assert.IsTrue(txtDateEffective.Date.Value.Year < 1910 || txtDateEffective.Date.Value.Year > 2980);

            // Now we should be able to delete the row we could not delete before
            Assert.IsTrue(btnDeleteTester.Properties.Enabled);

            // Change to the first row
            Assert.AreEqual(3, mainScreen.GetSelectedRowIndex());
            Assert.IsTrue(txtDateEffective.Date.Value.Year < 1910 || txtDateEffective.Date.Value.Year > 2980);
            SelectRowInGrid(1);
            Assert.IsTrue(txtDateEffective.Date.Value.Year < 1910 || txtDateEffective.Date.Value.Year > 2980);
            Assert.AreEqual(1, mainScreen.GetSelectedRowIndex());

            // So now we should have our 2 rows far in the future at the top which are not used anywhere
            ModalFormHandler = delegate(string name, IntPtr hWnd, Form form)
            {
                MessageBoxTester tester = new MessageBoxTester(hWnd);
                tester.SendCommand(MessageBoxTester.Command.Yes);
            };
            btnDeleteTester.Click();
            Assert.IsTrue(txtDateEffective.Date.Value.Year < 1910 || txtDateEffective.Date.Value.Year > 2980);
            ModalFormHandler = delegate(string name, IntPtr hWnd, Form form)
            {
                MessageBoxTester tester = new MessageBoxTester(hWnd);
                tester.SendCommand(MessageBoxTester.Command.Yes);
            };
            btnDeleteTester.Click();
            Assert.IsTrue(txtDateEffective.Date.Value.Year < 1910 || txtDateEffective.Date.Value.Year > 2980);

            // Should still be on row 1 with 7 grid rows now that 2 have gone
            Assert.AreEqual(1, mainScreen.GetSelectedRowIndex());
            Assert.IsTrue(btnDeleteTester.Properties.Enabled);
            Assert.AreEqual(7, grdDetails.Rows.Count);

            // Delete rows starting at the bottom
            SelectRowInGrid(6);
            ModalFormHandler = delegate(string name, IntPtr hWnd, Form form)
            {
                MessageBoxTester tester = new MessageBoxTester(hWnd);
                tester.SendCommand(MessageBoxTester.Command.Yes);
            };
            btnDeleteTester.Click();
            ModalFormHandler = delegate(string name, IntPtr hWnd, Form form)
            {
                MessageBoxTester tester = new MessageBoxTester(hWnd);
                tester.SendCommand(MessageBoxTester.Command.Yes);
            };
            btnDeleteTester.Click();

            Assert.AreEqual(4, mainScreen.GetSelectedRowIndex());
            Assert.IsTrue(btnDeleteTester.Properties.Enabled);
            Assert.AreEqual(5, grdDetails.Rows.Count);

            // Save the new settings - deleting does not remove inverse rows when saved
            Assert.IsTrue(btnSaveTester.Properties.Enabled);
            btnSaveTester.Click();
            Assert.IsFalse(btnSaveTester.Properties.Enabled);
            Assert.AreEqual(5, grdDetails.Rows.Count);
        }
Exemplo n.º 12
0
        private TFrmGLCreateLedgerTester()
        {
            TFrmGLCreateLedgerDialog = new TFrmGLCreateLedgerDialog(null);

            nudLedgerNumber = new NumericUpDownTester("nudLedgerNumber", TFrmGLCreateLedgerDialog);

            txtLedgerName = new TextBoxTester("txtLedgerName", TFrmGLCreateLedgerDialog);

            cmbCountryCode = new TCmbAutoPopulatedTester("cmbCountryCode", TFrmGLCreateLedgerDialog);
            cmbBaseCurrency = new TCmbAutoPopulatedTester("cmbBaseCurrency", TFrmGLCreateLedgerDialog);
            cmbIntlCurrency = new TCmbAutoPopulatedTester("cmbIntlCurrency", TFrmGLCreateLedgerDialog);

            // TextBoxTester dtpCalendarStartDate = new TextBoxTester("dtpCalendarStartDate", TFrmGLCreateLedgerDialog);

            nudNumberOfPeriods = new NumericUpDownTester("nudNumberOfPeriods", TFrmGLCreateLedgerDialog);
            nudCurrentPeriod = new NumericUpDownTester("nudCurrentPeriod", TFrmGLCreateLedgerDialog);
            nudNumberOfFwdPostingPeriods = new NumericUpDownTester("nudNumberOfFwdPostingPeriods", TFrmGLCreateLedgerDialog);

            tbbCreate = new ToolStripButtonTester("tbbCreate", TFrmGLCreateLedgerDialog);
        }