示例#1
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();
        }
		private ComboBoxTester GoToTabAndGetLanguageCombo()
		{
			GoToUILanguageTab();
			ComboBoxTester t = new ComboBoxTester("_languageCombo", _window);
			return t;
		}