Exemplo n.º 1
0
 public void SelectingSQLPageLoadsSettings()
 {
     ListViewTester listViewTester = new ListViewTester("PageListView", _optionsForm);
     listViewTester.Select("SQL Server");
     CheckBoxTester checkboxTester = new CheckBoxTester("chkUseSQLServer", _optionsForm);
     Assert.That(checkboxTester.Text, Does.Match("Use SQL"));
 }
 public void SelectingTabsPanelPageLoadsSettings()
 {
     ListViewTester listViewTester = new ListViewTester("PageListView", _optionsForm);
     listViewTester.Select("Tabs & Panels");
     CheckBoxTester checkboxTester = new CheckBoxTester("chkAlwaysShowPanelTabs", _optionsForm);
     Assert.That(checkboxTester.Text, Does.Match("Always show panel tabs"));
 }
 public void SelectingAdvancedPageLoadsSettings()
 {
     ListViewTester listViewTester = new ListViewTester("PageListView", _optionsForm);
     listViewTester.Select("Advanced");
     CheckBoxTester checkboxTester = new CheckBoxTester("chkWriteLogFile", _optionsForm);
     Assert.That(checkboxTester.Text, Does.Match("Write log file"));
 }
 public void SelectingUpdatesPageLoadsSettings()
 {
     ListViewTester listViewTester = new ListViewTester("PageListView", _optionsForm);
     listViewTester.Select("Updates");
     CheckBoxTester checkboxTester = new CheckBoxTester("chkCheckForUpdatesOnStartup", _optionsForm);
     Assert.That(checkboxTester.Text, Does.Match("Check for updates"));
 }
 public void SelectingConnectionsPageLoadsSettings()
 {
     ListViewTester listViewTester = new ListViewTester("PageListView", _optionsForm);
     listViewTester.Select("Connections");
     CheckBoxTester checkboxTester = new CheckBoxTester("chkSingleClickOnConnectionOpensIt", _optionsForm);
     Assert.That(checkboxTester.Text, Does.Match("Single click on connection"));
 }
 public void SelectingAppearancePageLoadsSettings()
 {
     ListViewTester listViewTester = new ListViewTester("PageListView", _optionsForm);
     listViewTester.Select("Appearance");
     CheckBoxTester checkboxTester = new CheckBoxTester("chkShowSystemTrayIcon", _optionsForm);
     Assert.That(checkboxTester.Text, Does.Match("show notification area icon"));
 }
 public void SelectingStartupExitPageLoadsSettings()
 {
     ListViewTester listViewTester = new ListViewTester("PageListView", _optionsForm);
     listViewTester.Select("Startup/Exit");
     CheckBoxTester checkboxTester = new CheckBoxTester("chkSaveConsOnExit", _optionsForm);
     Assert.That(checkboxTester.Text, Does.Match("Save connections"));
 }
 public void TestClickingOfCheckBoxUpdatesBO()
 {
     //---------------Set up test pack-------------------
     _cb.Name = "TestCheckBox";
     _cb.Checked = false;
     _sampleBusinessObject.SampleBoolean = false;
     _mapper.BusinessObject = _sampleBusinessObject;
     Form frm = AddControlToForm(_cb);
     //---------------Execute Test ----------------------
     frm.Show();
     CheckBoxTester box = new CheckBoxTester("TestCheckBox");
     box.Click();
     box.Check();
     //---------------Test Result -----------------------
     Assert.IsTrue(_cb.Checked);
     Assert.IsTrue(_sampleBusinessObject.SampleBoolean);
     //---------------Tear down -------------------------
 }
Exemplo n.º 9
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.º 10
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();
        }
//        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);
        }