本文整理汇总了C#中IProgressMonitor.Worked方法的典型用法代码示例。如果您正苦于以下问题:C# IProgressMonitor.Worked方法的具体用法?C# IProgressMonitor.Worked怎么用?C# IProgressMonitor.Worked使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IProgressMonitor
的用法示例。
在下文中一共展示了IProgressMonitor.Worked方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Install
public override void Install(IProgressMonitor progressMonitor)
{
using (progressMonitor.BeginTask("Installing TestDriven.Net Runner", testFrameworkManager.TestFrameworkHandles.Count + 2))
{
// Remove old registrations.
RemoveExistingRegistryKeys(progressMonitor);
progressMonitor.Worked(1);
// Register Icarus
string icarusPath = FindIcarusPath();
if (icarusPath != null)
InstallRegistryKeysForIcarus(icarusPath, progressMonitor);
progressMonitor.Worked(1);
// Register frameworks
foreach (ComponentHandle<ITestFramework, TestFrameworkTraits> testFrameworkHandle in testFrameworkManager.TestFrameworkHandles)
{
TestFrameworkTraits testFrameworkTraits = testFrameworkHandle.GetTraits();
TDNetRunnerInstallationMode installationMode = preferenceManager.GetInstallationModeForFramework(testFrameworkHandle.Id);
if (installationMode != TDNetRunnerInstallationMode.Disabled)
{
int priority = installationMode == TDNetRunnerInstallationMode.Default ? 25 : 5;
foreach (AssemblySignature frameworkAssembly in testFrameworkTraits.FrameworkAssemblies)
{
InstallRegistryKeysForFramework(testFrameworkTraits.Name, frameworkAssembly, priority,
progressMonitor);
}
}
progressMonitor.Worked(1);
}
}
}
示例2: 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);
}
}
示例3: SaveReportAs
public string SaveReportAs(Report report, string fileName, string format, IProgressMonitor progressMonitor)
{
var file = string.Empty;
using (progressMonitor.BeginTask("Generating report", 100))
{
var folderName = Path.GetDirectoryName(fileName);
var reportContainer = new FileSystemReportContainer(folderName,
Path.GetFileNameWithoutExtension(fileName));
var reportWriter = reportManager.CreateReportWriter(report, reportContainer);
if (progressMonitor.IsCanceled)
throw new OperationCanceledException();
// Delete the report if it already exists
reportContainer.DeleteReport();
if (progressMonitor.IsCanceled)
throw new OperationCanceledException();
progressMonitor.Worked(10);
// Format the report
var reportFormatterOptions = new ReportFormatterOptions();
using (var subProgressMonitor = progressMonitor.CreateSubProgressMonitor(90))
reportManager.Format(reportWriter, format, reportFormatterOptions, subProgressMonitor);
if (progressMonitor.IsCanceled)
throw new OperationCanceledException();
if (reportWriter.ReportDocumentPaths.Count > 0)
file = Path.Combine(folderName, reportWriter.ReportDocumentPaths[0]);
}
return file;
}
示例4: BuildTree
public TestTreeNode BuildTree(IProgressMonitor progressMonitor, TestModelData testModelData,
TreeBuilderOptions options)
{
var root = new TestDataNode(testModelData.RootTest);
progressMonitor.Worked(1);
PopulateNamespaceTree(progressMonitor, testModelData.RootTest.Children,
root, options);
return root;
}
示例5: Format
/// <inheritdoc />
public override void Format(IReportWriter reportWriter, ReportFormatterOptions formatterOptions, IProgressMonitor progressMonitor)
{
using (progressMonitor.BeginTask("Formatting report.", 10))
{
using (MultipartMimeReportContainer archiveContainer = new MultipartMimeReportContainer(reportWriter.ReportContainer))
{
string archivePath = archiveContainer.ReportName + ".mht";
reportWriter.AddReportDocumentPath(archivePath);
archiveContainer.OpenArchive(archivePath);
progressMonitor.Worked(0.5);
DefaultReportWriter archiveWriter = new DefaultReportWriter(reportWriter.Report, archiveContainer);
using (IProgressMonitor subProgressMonitor = progressMonitor.CreateSubProgressMonitor(9))
htmlReportFormatter.Format(archiveWriter, formatterOptions, subProgressMonitor);
archiveContainer.CloseArchive();
progressMonitor.Worked(0.5);
}
}
}
示例6: PopulateMetadataTree
private static void PopulateMetadataTree(IProgressMonitor progressMonitor, string metadataType,
TestData testData, Node parentNode, TestTreeNode rootNode)
{
TestDataNode testDataNode = AddMetadataNode(testData, metadataType,
rootNode, parentNode);
foreach (var childTestData in testData.Children)
{
PopulateMetadataTree(progressMonitor, metadataType, childTestData,
testDataNode, rootNode);
}
progressMonitor.Worked(1);
}
示例7: BuildTree
public TestTreeNode BuildTree(IProgressMonitor progressMonitor,
TestModelData testModelData, TreeBuilderOptions options)
{
var root = new TestDataNode(testModelData.RootTest);
progressMonitor.Worked(1);
foreach (var childTestData in testModelData.RootTest.Children)
{
PopulateMetadataTree(progressMonitor, options.TreeViewCategory,
childTestData, null, root);
}
return root;
}
示例8: PopulateNamespaceTree
private static void PopulateNamespaceTree(IProgressMonitor progressMonitor, IList<TestData> list,
TestTreeNode parent, TreeBuilderOptions options)
{
for (var i = 0; i < list.Count; i++)
{
var testData = list[i];
var testTreeNode = AddNode(testData, parent,
options);
// process child nodes
PopulateNamespaceTree(progressMonitor, testData.Children, testTreeNode,
options);
progressMonitor.Worked(1);
}
}
示例9: ApplyPendingSettingsChanges
public override void ApplyPendingSettingsChanges(IElevationContext elevationContext, IProgressMonitor progressMonitor)
{
using (progressMonitor.BeginTask("Saving TestDriven.Net preferences.", 2))
{
base.ApplyPendingSettingsChanges(elevationContext, progressMonitor);
foreach (DataGridViewRow row in frameworkGridView.Rows)
{
var installationMode = InstallationModeFromString((string)row.Cells[1].Value);
var frameworkId = (string)row.Tag;
PreferenceManager.SetInstallationModeForFramework(frameworkId, installationMode);
}
progressMonitor.Worked(1);
InstallerManager.Install(new[] {TDNetRunnerInstaller.InstallerId}, elevationContext, progressMonitor.CreateSubProgressMonitor(1));
}
}
示例10: 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;
}
示例11: 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;
}
示例12: Execute
public void Execute(IProgressMonitor progressMonitor)
{
var testFilters = projectController.TestFilters.Value;
var totalWorkUnits = testFilters.Count > 0 ? testFilters.Count : 1;
using (progressMonitor.BeginTask("Restoring test filter", totalWorkUnits))
{
foreach (var filterInfo in testFilters)
{
if (filterInfo.FilterName != FilterName)
{
progressMonitor.Worked(1);
continue;
}
ApplyFilter(progressMonitor, filterInfo);
return;
}
}
}
示例13: RunTestStep
private TestResult RunTestStep(ITestCommand testCommand, TestInfoData testStepInfo, TestStep parentTestStep, IProgressMonitor progressMonitor)
{
ITestContext testContext = testCommand.StartPrimaryChildStep(parentTestStep);
TestStepResult testStepResult = repository.RunTest(testStepInfo);
reporter.Run(testContext, testStepInfo, testStepResult);
WriteToTestLog(testContext, testStepResult);
testContext.AddAssertCount(testStepResult.AssertCount);
progressMonitor.Worked(1);
return testContext.FinishStep(testStepResult.TestOutcome, testStepResult.Duration);
}
示例14: 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);
}
}
}
示例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);
}
}
}