示例#1
0
        private void RunExcelTests()
        {
            NetOffice.Core.Default.Console.Name = "ExcelTests";
            NetOffice.Core.Default.Console.EnableSharedOutput = true;

            ExcelTestsVB.TestAssembly excelVB = new ExcelTestsVB.TestAssembly();
            foreach (ITestPackage item in excelVB.LoadTestPackages())
            {
                ShowCurrentTestPackge(item);
                TestResult result = null;
                try
                {
                    result = item.DoTest();
                }
                catch (Exception exception)
                {
                    result = new TestResult(false, TimeSpan.MinValue, "Unexpected Error.", exception, "");
                }
                AddTestResult(item, result);
            }

            ExcelTestsCSharp.TestAssembly excelCSharp = new ExcelTestsCSharp.TestAssembly();
            foreach (ITestPackage item in excelCSharp.LoadTestPackages())
            {
                ShowCurrentTestPackge(item);
                TestResult result = null;
                try
                {
                    result = item.DoTest();
                }
                catch (Exception exception)
                {
                    result = new TestResult(false, TimeSpan.MinValue, "Unexpected Error.", exception, "");
                }
                AddTestResult(item, result);
            }
        }
示例#2
0
        private void RunExcelTests()
        {
            NetOffice.Core.Default.Console.Name = "ExcelTests";
            NetOffice.Core.Default.Console.EnableSharedOutput = true;

            ExcelTestsVB.TestAssembly excelVB = new ExcelTestsVB.TestAssembly();
            foreach (ITestPackage item in excelVB.LoadTestPackages())
            {
                ShowCurrentTestPackge(item);
                TestResult result = null;
                try
                {
                    result = item.DoTest();
                }
                catch (Exception exception)
                {
                    result = new TestResult(false, TimeSpan.MinValue, "Unexpected Error.", exception, "");
                }
                AddTestResult(item, result);
            }

            ExcelTestsCSharp.TestAssembly excelCSharp = new ExcelTestsCSharp.TestAssembly();
            foreach (ITestPackage item in excelCSharp.LoadTestPackages())
            {
                ShowCurrentTestPackge(item);
                TestResult result = null;
                try
                {
                    result = item.DoTest();
                }
                catch (Exception exception)
                {
                    result = new TestResult(false, TimeSpan.MinValue, "Unexpected Error.", exception, "");
                }
                AddTestResult(item, result);
            }
        }
示例#3
0
文件: Form1.cs 项目: vnkolt/NetOffice
        void buttonTest_Click(object sender, EventArgs e)
        {
            try
            {   
                buttonTest.Enabled =false;
                listViewResults.Items.Clear();
                
                #region Excel

                if (checkBoxExcel.Checked)
                { 
                    ExcelTestsVB.TestAssembly excelVB = new ExcelTestsVB.TestAssembly();
                    foreach (ITestPackage item in excelVB.LoadTestPackages())
                    {
                        ShowCurrent(item);
                        TestResult result = item.DoTest();
                        AddResult(item, result);
                    }

                    ExcelTestsCSharp.TestAssembly excelCSharp = new ExcelTestsCSharp.TestAssembly();
                    foreach (ITestPackage item in excelCSharp.LoadTestPackages())
                    {
                        ShowCurrent(item);
                        TestResult result = item.DoTest();
                        AddResult(item, result);
                    }
                }

                #endregion

                #region Outlook

                if (checkBoxOutlook.Checked)
                { 
                    OutlookTestsVB.TestAssembly outlookVB = new OutlookTestsVB.TestAssembly();
                    foreach (ITestPackage item in outlookVB.LoadTestPackages())
                    {
                        ShowCurrent(item);
                        TestResult result = item.DoTest();
                        AddResult(item, result);
                    }

                    OutlookTestsCSharp.TestAssembly outlookCSharp = new OutlookTestsCSharp.TestAssembly();
                    foreach (ITestPackage item in outlookCSharp.LoadTestPackages())
                    {
                        ShowCurrent(item);
                        TestResult result = item.DoTest();
                        AddResult(item, result);
                    }
                }

                #endregion

                #region Word

                if (checkBoxWord.Checked)
                {
                    WordTestsVB.TestAssembly wordVB = new WordTestsVB.TestAssembly();
                    foreach (ITestPackage item in wordVB.LoadTestPackages())
                    {
                        ShowCurrent(item);
                        TestResult result = item.DoTest();
                        AddResult(item, result);
                    }

                    WordTestsCSharp.TestAssembly wordCSharp = new WordTestsCSharp.TestAssembly();
                    foreach (ITestPackage item in wordCSharp.LoadTestPackages())
                    {
                        ShowCurrent(item);
                        TestResult result = item.DoTest();
                        AddResult(item, result);
                    }
                }

                #endregion

                #region PowerPoint

                if (checkBoxPowerPoint.Checked)
                {
                    PowerPointTestsVB.TestAssembly powerVB = new PowerPointTestsVB.TestAssembly();
                    foreach (ITestPackage item in powerVB.LoadTestPackages())
                    {
                        ShowCurrent(item);
                        TestResult result = item.DoTest();
                        AddResult(item, result);
                    }

                    PowerPointTestsCSharp.TestAssembly powerCSharp = new PowerPointTestsCSharp.TestAssembly();
                    foreach (ITestPackage item in powerCSharp.LoadTestPackages())
                    {
                        ShowCurrent(item);
                        TestResult result = item.DoTest();
                        AddResult(item, result);
                    }
                }

                #endregion

                #region AccessPoint

                if (checkBoxAccess.Checked)
                {
                    AccessTestsVB.TestAssembly accessVB = new AccessTestsVB.TestAssembly();
                    foreach (ITestPackage item in accessVB.LoadTestPackages())
                    {
                        ShowCurrent(item);
                        TestResult result = item.DoTest();
                        AddResult(item, result);
                    }

                    AccessTestsCSharp.TestAssembly accessCSharp = new AccessTestsCSharp.TestAssembly();
                    foreach (ITestPackage item in accessCSharp.LoadTestPackages())
                    {
                        ShowCurrent(item);
                        TestResult result = item.DoTest();
                        AddResult(item, result);
                    }
                }

                #endregion

                #region Project

                if (checkBoxProject.Checked)
                {
                    ProjectTestsVB.TestAssembly projectVB = new ProjectTestsVB.TestAssembly();
                    foreach (ITestPackage item in projectVB.LoadTestPackages())
                    {
                        ShowCurrent(item);
                        TestResult result = item.DoTest();
                        AddResult(item, result);
                    }

                    ProjectTestsCSharp.TestAssembly projectCSharp = new ProjectTestsCSharp.TestAssembly();
                    foreach (ITestPackage item in projectCSharp.LoadTestPackages())
                    {
                        ShowCurrent(item);
                        TestResult result = item.DoTest();
                        AddResult(item, result);
                    }
                }

                #endregion
            }
            catch (Exception exception)
            {
                string message = Environment.NewLine + Environment.NewLine + exception.Message;
                MessageBox.Show("We have an Error" + message, "Huston", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                labelCurrentTest.Text = string.Empty;
                buttonTest.Enabled = true;
            }
        }