Пример #1
0
        public void Execute()
        {
            WorkbookContext workbookContext = App.Context.GetActiveWorkbookContext();
            var testContext = new TestContextImpl(workbookContext);
            testContext.Compile(workbookContext.TestCases);

            if (0 < testContext.TestSequence.CompileErrorCount)
            {
                throw new InvalidOperationException(Properties.Resources.CompilerError);
            }

            if (0 == testContext.TestSequence.CountTotal())
            {
                throw new InvalidOperationException(Properties.Resources.TestIsEmpty);
            }

            App.Context.GetActiveWindowContext().HelpPaneVisible = false;
            workbookContext.DeleteEvidenceAll();

            using (var form = new View.TestRunForm())
            {
                form.TestContext = testContext;
                form.ShowDialog();
            }
        }
        public void Execute()
        {
            WorkbookContext workbookContext = App.Context.GetActiveWorkbookContext();
            var             testContext     = new TestContextImpl(workbookContext);
            var             testCase        = workbookContext.GetActiveTestCase();

            if (null == testCase)
            {
                throw new InvalidOperationException(Properties.Resources.ScenarioIsNotSelected);
            }

            Excel.ListObject listObject = ListObjectHelper.GetTestCases(testCase.Worksheet).FirstOrDefault();

            if (null != listObject)
            {
                listObject.DataBodyRange.Columns[ListRowHelper.ColumnIndex.Result].Clear();
                listObject.DataBodyRange.Columns[ListRowHelper.ColumnIndex.Error].Clear();
                listObject.DataBodyRange.Columns[ListRowHelper.ColumnIndex.Evidence].Clear();
            }

            if (null == testCase)
            {
                throw new InvalidOperationException(Properties.Resources.ScenarioIsNotSelected);
            }

            App.Context.GetActiveWindowContext().HelpPaneVisible = false;
            testContext.Compile(testCase);

            if (0 < testContext.TestSequence.CompileErrorCount)
            {
                throw new InvalidOperationException(Properties.Resources.CompilerError);
            }

            if (0 == testContext.TestSequence.CountTotal())
            {
                throw new InvalidOperationException(Properties.Resources.TestIsEmpty);
            }

            //workbookContext.DeleteEvidenceAll();

            testCase.Result = TestResult.None;

            using (var form = new View.TestRunForm())
            {
                form.TestContext = testContext;
                form.ShowDialog();
            }
        }