当前位置: 首页>>代码示例>>C#>>正文


C# IProgressMonitor.SetStatus方法代码示例

本文整理汇总了C#中IProgressMonitor.SetStatus方法的典型用法代码示例。如果您正苦于以下问题:C# IProgressMonitor.SetStatus方法的具体用法?C# IProgressMonitor.SetStatus怎么用?C# IProgressMonitor.SetStatus使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IProgressMonitor的用法示例。


在下文中一共展示了IProgressMonitor.SetStatus方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Execute

        /// <inheritdoc />
        protected override void Execute(UnmanagedTestRepository repository, IProgressMonitor progressMonitor)
        {
            using (progressMonitor.BeginTask("Running " + repository.FileName, 4))
            {
                progressMonitor.SetStatus("Building the test model.");
                BuildTestModel(repository, progressMonitor);
                progressMonitor.Worked(1);

                progressMonitor.SetStatus("Running the tests.");
                RunTests(repository, progressMonitor);
                progressMonitor.Worked(3);
            }
        }
开发者ID:dougrathbone,项目名称:mbunit-v3,代码行数:14,代码来源:RunTask.cs

示例2: RunTest

        private TestResult RunTest(ITestCommand testCommand, TestStep parentTestStep, IProgressMonitor progressMonitor)
        {
            Test test = testCommand.Test;
            progressMonitor.SetStatus(test.Name);

            // The first test should be an assembly test
            MSTestAssembly assemblyTest = testCommand.Test as MSTestAssembly;
            TestOutcome outcome;
            TestResult result;
            if (assemblyTest != null)
            {
                ITestContext assemblyContext = testCommand.StartPrimaryChildStep(parentTestStep);
                try
                {
                    MSTestRunner runner = MSTestRunner.GetRunnerForFrameworkVersion(frameworkVersion);

                    outcome = runner.RunSession(assemblyContext, assemblyTest,
                        testCommand, parentTestStep, progressMonitor);
                }
                catch (Exception ex)
                {
                    assemblyContext.LogWriter.Failures.WriteException(ex, "Internal Error");
                    outcome = TestOutcome.Error;
                }

                result = assemblyContext.FinishStep(outcome, null);
            }
            else
            {
                result = new TestResult(TestOutcome.Skipped);
            }

            progressMonitor.Worked(1);
            return result;
        }
开发者ID:dougrathbone,项目名称:mbunit-v3,代码行数:35,代码来源:MSTestController.cs

示例3: RunSession

        public TestOutcome RunSession(ITestContext assemblyTestContext, MSTestAssembly assemblyTest,
            ITestCommand assemblyTestCommand, TestStep parentTestStep, IProgressMonitor progressMonitor)
        {
            DirectoryInfo tempDir = SpecialPathPolicy.For("MSTestAdapter").CreateTempDirectoryWithUniqueName();
            try
            {
                // Set the test results path.  Among other things, the test results path
                // will determine where the deployed test files go.
                string testResultsPath = Path.Combine(tempDir.FullName, "tests.trx");

                // Set the test results root directory.
                // This path determines both where MSTest searches for test files which
                // is used to resolve relative paths to test files in the "*.vsmdi" file.
                string searchPathRoot = Path.GetDirectoryName(assemblyTest.AssemblyFilePath);

                // Set the test metadata and run config paths.  These are just temporary
                // files that can go anywhere on the filesystem.  It happens to be convenient
                // to store them in the same temporary directory as the test results.
                string testMetadataPath = Path.Combine(tempDir.FullName, "tests.vsmdi");
                string runConfigPath = Path.Combine(tempDir.FullName, "tests.runconfig");

                progressMonitor.SetStatus("Generating test metadata file.");
                CreateTestMetadataFile(testMetadataPath,
                    GetTestsFromCommands(assemblyTestCommand.PreOrderTraversal), assemblyTest.AssemblyFilePath);

                progressMonitor.SetStatus("Generating run config file.");
                CreateRunConfigFile(runConfigPath);

                progressMonitor.SetStatus("Executing tests.");
                Executor executor = new Executor(this, assemblyTestContext, assemblyTestCommand);
                TestOutcome outcome = executor.Execute(testMetadataPath, testResultsPath,
                    runConfigPath, searchPathRoot);
                return outcome;
            }
            finally
            {
                try
                {
                    tempDir.Delete(true);
                }
                catch
                {
                    // Ignore I/O exceptions deleting temporary files.
                    // They will probably be deleted by the OS later on during a file cleanup.
                }
            }
        }
开发者ID:dougrathbone,项目名称:mbunit-v3,代码行数:47,代码来源:MSTestRunner.cs

示例4: RunTest

        private static TestResult RunTest(ITestCommand testCommand, TestStep parentTestStep, IProgressMonitor progressMonitor)
        {
            Test test = testCommand.Test;
            progressMonitor.SetStatus(test.Name);

            TestResult result;
            ConcordionTest concordionTest = test as ConcordionTest;
            if (concordionTest == null)
            {
                result = RunChildTests(testCommand, parentTestStep, progressMonitor);
            }
            else
            {
                result = RunTestFixture(testCommand, concordionTest, parentTestStep);
            }

            progressMonitor.Worked(1);
            return result;
        }
开发者ID:john-ross,项目名称:concordion-net,代码行数:19,代码来源:ConcordionTestController.cs

示例5: RunTest

        private static TestResult RunTest(ITestCommand testCommand, TestStep parentTestStep, IProgressMonitor progressMonitor)
        {
            Test test = testCommand.Test;
            progressMonitor.SetStatus(test.Name);

            TestResult result;
            XunitTest xunitTest = test as XunitTest;
            if (xunitTest == null)
            {
                result = RunChildTests(testCommand, parentTestStep, progressMonitor);
            }
            else
            {
                result = RunTestFixture(testCommand, xunitTest.TypeInfo, parentTestStep);
            }

            progressMonitor.Worked(1);
            return result;
        }
开发者ID:dougrathbone,项目名称:mbunit-v3,代码行数:19,代码来源:XunitTestController.cs

示例6: RunTest

    private void RunTest(ITestCommand testCommand, ITestStep parentTestStep, IProgressMonitor progressMonitor)
    {
      ITest test = testCommand.Test;
      progressMonitor.SetStatus(test.Name);

      MachineSpecificationTest specification = test as MachineSpecificationTest;
      MachineContextTest description = test as MachineContextTest;
      if (specification != null)
      {
        //RunContextTest(specification, testComman);
      }
      else if (description != null)
      {
        RunContextTest(description, testCommand, parentTestStep);
      }
      else
      {
        Debug.WriteLine("Got something weird " + test.GetType().ToString());
      }
    }
开发者ID:benlovell,项目名称:machine.specifications,代码行数:20,代码来源:MachineSpecificationController.cs

示例7: CopyFile

        private void CopyFile(IProgressMonitor progressMonitor, string filePath)
        {
            try
            {
                var destinationFilePath = Path.Combine(destinationFolder, filePath);
                
                progressMonitor.SetStatus(destinationFilePath);

                var sourceFilePath = Path.Combine(sourceFolder, filePath);

                var destinationDirectory = Path.GetDirectoryName(destinationFilePath);
                if (!fileSystem.DirectoryExists(destinationDirectory))
                    fileSystem.CreateDirectory(destinationDirectory);

                fileSystem.CopyFile(sourceFilePath, destinationFilePath, true);
            }
            catch (Exception ex)
            {
                unhandledExceptionPolicy.Report(string.Format("Error copying file '{0}'.", filePath), ex);
            }
        }
开发者ID:dougrathbone,项目名称:mbunit-v3,代码行数:21,代码来源:CopyCommand.cs

示例8: LoadReport

        /// <inheritdoc />
        public Report LoadReport(bool loadAttachmentContents, IProgressMonitor progressMonitor)
        {
            if (progressMonitor == null)
                throw new ArgumentNullException(@"progressMonitor");

            using (progressMonitor.BeginTask(String.Format("Loading report '{0}'.", reportContainer.ReportName), 10))
            {
                string reportPath = reportContainer.ReportName + @".xml";

                progressMonitor.ThrowIfCanceled();
                progressMonitor.SetStatus(reportPath);

                var serializer = new XmlSerializer(typeof(Report));

                Report report;
                using (Stream stream = reportContainer.OpenRead(reportPath))
                {
                    progressMonitor.ThrowIfCanceled();
                    report = (Report)serializer.Deserialize(stream);
                }

                FixImplicitIds(report);

                progressMonitor.Worked(1);
                progressMonitor.SetStatus(@"");

                if (loadAttachmentContents)
                {
                    progressMonitor.ThrowIfCanceled();
                    using (IProgressMonitor subProgressMonitor = progressMonitor.CreateSubProgressMonitor(9))
                        LoadReportAttachments(report, subProgressMonitor);
                }

                return report;
            }
        }
开发者ID:dougrathbone,项目名称:mbunit-v3,代码行数:37,代码来源:DefaultReportReader.cs

示例9: InstallRegistryKeysForIcarus

        private void InstallRegistryKeysForIcarus(string icarusPath, IProgressMonitor progressMonitor, RegistryKey hiveKey, string rootKeyPath)
        {
            string subKeyName = string.Concat(rootKeyPath, @"\", RunnerRegKeyPrefix + "_Icarus"); // Note: 'Gallio_Icarus' is hardcoded in TDNet's config file.
            string message = "Adding TestDriven.Net runner registry key for Icarus.";

            logger.Log(LogSeverity.Info, message);
            progressMonitor.SetStatus(message);

            using (RegistryKey subKey = hiveKey.CreateSubKey(subKeyName, RegistryKeyPermissionCheck.ReadWriteSubTree))
            {
                subKey.SetValue(null, "1");
                subKey.SetValue("Application", icarusPath);
            }
        }
开发者ID:dougrathbone,项目名称:mbunit-v3,代码行数:14,代码来源:TDNetRunnerInstaller.cs

示例10: RemoveExistingRegistryKeys

        private void RemoveExistingRegistryKeys(IProgressMonitor progressMonitor, RegistryKey hiveKey, string rootKeyPath)
        {
            using (RegistryKey rootKey = hiveKey.OpenSubKey(rootKeyPath, true))
            {
                if (rootKey == null)
                    return;

                foreach (string subKeyName in rootKey.GetSubKeyNames())
                {
                    if (subKeyName.StartsWith(RunnerRegKeyPrefix))
                    {
                        string message = string.Format("Deleting TestDriven.Net runner registry key '{0}'.", subKeyName);

                        logger.Log(LogSeverity.Info, message);
                        progressMonitor.SetStatus(message);

                        rootKey.DeleteSubKeyTree(subKeyName);
                    }
                }
            }
        }
开发者ID:dougrathbone,项目名称:mbunit-v3,代码行数:21,代码来源:TDNetRunnerInstaller.cs

示例11: Format

        /// <inheritdoc />
        public override void Format(IReportWriter reportWriter, ReportFormatterOptions options, IProgressMonitor progressMonitor)
        {
            AttachmentContentDisposition attachmentContentDisposition = GetAttachmentContentDisposition(options);

            using (progressMonitor.BeginTask("Formatting report.", 10))
            {
                progressMonitor.SetStatus("Applying XSL transform.");
                ApplyTransform(reportWriter, attachmentContentDisposition, options);
                progressMonitor.Worked(3);

                progressMonitor.SetStatus("Copying resources.");
                CopyResources(reportWriter);
                progressMonitor.Worked(2);

                progressMonitor.SetStatus(@"");

                if (attachmentContentDisposition == AttachmentContentDisposition.Link)
                {
                    using (IProgressMonitor subProgressMonitor = progressMonitor.CreateSubProgressMonitor(5))
                        reportWriter.SaveReportAttachments(subProgressMonitor);
                }
            }
        }
开发者ID:dougrathbone,项目名称:mbunit-v3,代码行数:24,代码来源:XsltReportFormatter.cs

示例12: RunAssembly

        /// <inheritdoc />
        protected override sealed void RunAssembly(Assembly assembly, TestExplorationOptions testExplorationOptions, TestExecutionOptions testExecutionOptions, IMessageSink messageSink, IProgressMonitor progressMonitor)
        {
            using (progressMonitor.BeginTask(string.Format("Running {0} tests.", FrameworkName), 100))
            {
                using (TestHarness testHarness = CreateTestHarness())
                {
                    IDisposable appDomainState = null;
                    try
                    {
                        progressMonitor.SetStatus("Setting up the test harness.");
                        appDomainState = testHarness.SetUpAppDomain();
                        progressMonitor.Worked(1);

                        progressMonitor.SetStatus("Building the test model.");
                        TestModel testModel = GenerateTestModel(assembly, messageSink);
                        progressMonitor.Worked(3);

                        progressMonitor.SetStatus("Building the test commands.");
                        ITestContextManager testContextManager = CreateTestContextManager(messageSink);
                        ITestCommand rootTestCommand = GenerateCommandTree(testModel, testExecutionOptions, testContextManager);
                        progressMonitor.Worked(2);

                        progressMonitor.SetStatus("Running the tests.");
                        if (rootTestCommand != null)
                        {
                            RunTestCommandsAction action = new RunTestCommandsAction(this, rootTestCommand, testExecutionOptions,
                                testHarness, testContextManager, progressMonitor.CreateSubProgressMonitor(93));

                            if (testExecutionOptions.SingleThreaded)
                            {
                                // The execution options require the use of a single thread.
                                action.Run();
                            }
                            else
                            {
                                // Create a new thread so that we can consistently set the default apartment
                                // state to STA and so as to reduce the effective stack depth during the
                                // test run.  We use Thread instead of ThreadTask because we do not
                                // require the ability to abort the Thread so we do not need to take the
                                // extra overhead.
                                Thread thread = new Thread(action.Run);
                                thread.Name = "Simple Test Driver";
                                thread.SetApartmentState(ApartmentState.STA);
                                thread.Start();
                                thread.Join();
                            }

                            if (action.Exception != null)
                                throw new ModelException("A fatal exception occurred while running test commands.", action.Exception);
                        }
                        else
                        {
                            progressMonitor.Worked(93);
                        }
                    }
                    finally
                    {
                        progressMonitor.SetStatus("Tearing down the test harness.");
                        if (appDomainState != null)
                            appDomainState.Dispose();
                        progressMonitor.Worked(1);
                    }
                }
            }
        }
开发者ID:dougrathbone,项目名称:mbunit-v3,代码行数:66,代码来源:SimpleTestDriver.cs

示例13: ExploreAssembly

        /// <inheritdoc />
        protected override sealed void ExploreAssembly(Assembly assembly, TestExplorationOptions testExplorationOptions, IMessageSink messageSink, IProgressMonitor progressMonitor)
        {
            using (progressMonitor.BeginTask(string.Format("Exploring {0} tests.", FrameworkName), 5))
            {
                using (TestHarness testHarness = CreateTestHarness())
                {
                    IDisposable appDomainState = null;
                    try
                    {
                        progressMonitor.SetStatus("Setting up the test harness.");
                        appDomainState = testHarness.SetUpAppDomain();
                        progressMonitor.Worked(1);

                        progressMonitor.SetStatus("Building the test model.");
                        GenerateTestModel(assembly, messageSink);
                        progressMonitor.Worked(3);
                    }
                    finally
                    {
                        progressMonitor.SetStatus("Tearing down the test harness.");
                        if (appDomainState != null)
                            appDomainState.Dispose();
                        progressMonitor.Worked(1);
                    }
                }
            }
        }
开发者ID:dougrathbone,项目名称:mbunit-v3,代码行数:28,代码来源:SimpleTestDriver.cs

示例14: DescribeImpl

 /// <inheritdoc />
 protected override sealed void DescribeImpl(IReflectionPolicy reflectionPolicy, IList<ICodeElementInfo> codeElements, TestExplorationOptions testExplorationOptions, IMessageSink messageSink, IProgressMonitor progressMonitor)
 {
     using (progressMonitor.BeginTask(string.Format("Describing {0} tests.", FrameworkName), 100))
     {
         progressMonitor.SetStatus("Building the test model.");
         GenerateTestModel(reflectionPolicy, codeElements, messageSink);
     }
 }
开发者ID:dougrathbone,项目名称:mbunit-v3,代码行数:9,代码来源:SimpleTestDriver.cs

示例15: ExploreOrRunAssembly

        private void ExploreOrRunAssembly(ITestIsolationContext testIsolationContext, TestPackage testPackage, TestExplorationOptions testExplorationOptions,
            TestExecutionOptions testExecutionOptions, RemoteMessageSink remoteMessageSink, IProgressMonitor progressMonitor, string taskName,
            FileInfo file)
        {
            using (progressMonitor.BeginTask(taskName, 100))
            {
                if (progressMonitor.IsCanceled)
                    return;

                string assemblyPath = file.FullName;
                progressMonitor.SetStatus("Getting test assembly metadata.");
                AssemblyMetadata assemblyMetadata = AssemblyUtils.GetAssemblyMetadata(assemblyPath, AssemblyMetadataFields.RuntimeVersion);
                progressMonitor.Worked(2);

                if (progressMonitor.IsCanceled)
                    return;

                if (assemblyMetadata != null)
                {
                    Type driverType = GetType();
                    object[] driverArguments = GetRemoteTestDriverArguments();

                    HostSetup hostSetup = CreateHostSetup(testPackage, assemblyPath, assemblyMetadata);

                    using (var remoteProgressMonitor = new RemoteProgressMonitor(
                        progressMonitor.CreateSubProgressMonitor(97)))
                    {
                        testIsolationContext.RunIsolatedTask<ExploreOrRunTask>(hostSetup,
                            (statusMessage) => progressMonitor.SetStatus(statusMessage),
                            new object[] { driverType, driverArguments, assemblyPath, testExplorationOptions, testExecutionOptions, remoteMessageSink, remoteProgressMonitor });
                    }

                    // Record one final work unit after the isolated task has been fully cleaned up.
                    progressMonitor.SetStatus("");
                    progressMonitor.Worked(1);
                }
            }
        }
开发者ID:dougrathbone,项目名称:mbunit-v3,代码行数:38,代码来源:DotNetTestDriver.cs


注:本文中的IProgressMonitor.SetStatus方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。