Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add setting for OpenCover -register switch #208

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Use RegisterAs setting on OpenCover execution
  • Loading branch information
jgasiorowski committed Sep 24, 2019
commit 4917e1f550a4f5a62ba979f2a6b3e7448098a2c1
3 changes: 2 additions & 1 deletion AxoCover/Models/Testing/Data/OpenCoverOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public class OpenCoverOptions
public string ExcludeDirectories { get; set; }
public string Filters { get; set; }
public bool IsVisitorCountLimited { get; set; }
public int VisitorCountLimit { get; set; }
public int VisitorCountLimit { get; set; }
public string RegisterAs { get; set; }
}
}
5 changes: 4 additions & 1 deletion AxoCover/Models/Testing/Execution/AxoTestRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Security.Principal;
using System.Threading;

namespace AxoCover.Models.Testing.Execution
Expand Down Expand Up @@ -85,7 +86,9 @@ protected override TestReport RunTests(TestItem testItem, bool isCovering, bool
Filters = _options.Filters,
IsVisitorCountLimited = _options.IsVisitorCountLimited,
VisitorCountLimit = _options.VisitorCountLimit,
PdbDirectories = solution.Children.OfType<TestProject>().Select(p => p.OutputDirectory)
PdbDirectories = solution.Children.OfType<TestProject>().Select(p => p.OutputDirectory),
RegisterAs = string.IsNullOrEmpty(_options.RegisterAs) ?
new WindowsPrincipal(WindowsIdentity.GetCurrent()).IsInRole(WindowsBuiltInRole.Administrator) ? "administrator" : "user" : _options.RegisterAs
};
hostProcessInfo = new OpenCoverProcessInfo(openCoverOptions);
}
Expand Down
2 changes: 1 addition & 1 deletion AxoCover/Models/Testing/Execution/OpenCoverProcessInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public string FilePath
public OpenCoverProcessInfo(OpenCoverOptions options)
{
CoverageReportPath = options.CoverageReportPath;
_baseArguments = GetSettingsBasedArguments(options) + $" -output:\"{options.CoverageReportPath}\" -register:user";
_baseArguments = GetSettingsBasedArguments(options) + $" -output:\"{options.CoverageReportPath}\" -register:{options.RegisterAs}";
}

private static string GetSettingsBasedArguments(OpenCoverOptions options)
Expand Down