Skip to content

Commit

Permalink
Added mergebyhash and skipautoprops options
Browse files Browse the repository at this point in the history
  • Loading branch information
axodox committed Mar 15, 2017
1 parent 59ceed4 commit 73827e7
Show file tree
Hide file tree
Showing 12 changed files with 120 additions and 4 deletions.
2 changes: 2 additions & 0 deletions AxoCover/Models/AxoTestRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ protected override TestReport RunTests(TestItem testItem, bool isCovering, bool
IsCoveringByTest = _options.IsCoveringByTest,
IsIncludingSolutionAssemblies = _options.IsIncludingSolutionAssemblies,
IsExcludingTestAssemblies = _options.IsExcludingTestAssemblies,
IsMergingByHash = _options.IsMergingByHash,
IsSkippingAutoProps = _options.IsSkippingAutoProps,
ExcludeAttributes = _options.ExcludeAttributes,
ExcludeDirectories = _options.ExcludeDirectories,
ExcludeFiles = _options.ExcludeFiles,
Expand Down
2 changes: 2 additions & 0 deletions AxoCover/Models/Data/OpenCoverOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ public class OpenCoverOptions
public bool IsCoveringByTest { get; set; }
public bool IsIncludingSolutionAssemblies { get; set; }
public bool IsExcludingTestAssemblies { get; set; }
public bool IsMergingByHash { get; set; }
public bool IsSkippingAutoProps { get; set; }
public string ExcludeAttributes { get; set; }
public string ExcludeFiles { get; set; }
public string ExcludeDirectories { get; set; }
Expand Down
6 changes: 4 additions & 2 deletions AxoCover/Models/IOptions.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System;
using AxoCover.Common.Settings;
using System;
using System.ComponentModel;
using System.Windows.Media;
using AxoCover.Common.Settings;

namespace AxoCover.Models
{
Expand Down Expand Up @@ -36,6 +36,8 @@ public interface IOptions
TestPlatform TestPlatform { get; set; }
string TestRunner { get; set; }
Color UncoveredColor { get; set; }
bool IsMergingByHash { get; set; }
bool IsSkippingAutoProps { get; set; }

event PropertyChangedEventHandler PropertyChanged;
}
Expand Down
12 changes: 11 additions & 1 deletion AxoCover/Models/OpenCoverProcessInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,23 @@ public string FilePath
public OpenCoverProcessInfo(OpenCoverOptions options)
{
CoverageReportPath = options.CoverageReportPath;
_baseArguments = GetSettingsBasedArguments(options) + $"-mergebyhash -output:\"{options.CoverageReportPath}\" -register:user";
_baseArguments = GetSettingsBasedArguments(options) + $" -output:\"{options.CoverageReportPath}\" -register:user";
}

private static string GetSettingsBasedArguments(OpenCoverOptions options)
{
var arguments = string.Empty;

if (options.IsMergingByHash)
{
arguments += " -mergebyhash";
}

if (options.IsSkippingAutoProps)
{
arguments += " -skipautoprops";
}

if (options.IsCoveringByTest)
{
arguments += " -coverbytest:" + string.Join(";", options.TestAssemblies.Select(p => "*" + p + "*"));
Expand Down
12 changes: 12 additions & 0 deletions AxoCover/Models/Options.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,18 @@ public bool IsCoveringByTest
get { return Settings.Default.IsCoveringByTest; }
set { Settings.Default.IsCoveringByTest = value; }
}

public bool IsMergingByHash
{
get { return Settings.Default.IsMergingByHash; }
set { Settings.Default.IsMergingByHash = value; }
}

public bool IsSkippingAutoProps
{
get { return Settings.Default.IsSkippingAutoProps; }
set { Settings.Default.IsSkippingAutoProps = value; }
}
#endregion

#region Visualization settings
Expand Down
24 changes: 24 additions & 0 deletions AxoCover/Properties/Settings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions AxoCover/Properties/Settings.settings
Original file line number Diff line number Diff line change
Expand Up @@ -86,5 +86,11 @@
<Setting Name="TestSettings" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
<Setting Name="IsMergingByHash" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="IsSkippingAutoProps" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
</Settings>
</SettingsFile>
36 changes: 36 additions & 0 deletions AxoCover/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions AxoCover/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -480,4 +480,16 @@
<data name="AssemblyVersion" xml:space="preserve">
<value>Build version is {0}, please reference this in your feedback.</value>
</data>
<data name="IsMergingByHash" xml:space="preserve">
<value>Merge by hash</value>
</data>
<data name="IsMergingByHashDescription" xml:space="preserve">
<value>Under some scenarios e.g. using MSTest, an assembly may be loaded many times from different locations. This option is used to merge the coverage results for an assembly regardless of where it was loaded assuming the assembly has the same file-hash in each location.</value>
</data>
<data name="IsSkippingAutoProps" xml:space="preserve">
<value>Skip auto properties</value>
</data>
<data name="IsSkippingAutoPropsDescription" xml:space="preserve">
<value>Neither track nor record auto-implemented properties. That is, skip getters and setters like these: public bool Service { get; set; }</value>
</data>
</root>
4 changes: 4 additions & 0 deletions AxoCover/Views/SettingsView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,10 @@
<Image Source="/AxoCover;component/Resources/warning.png" Stretch="None" DockPanel.Dock="Left" Margin="3"/>
<TextBlock Text="{x:Static res:Resources.CoverByTestExcludeByTestAssemblyWarning}" Style="{StaticResource Description}"/>
</DockPanel>
<CheckBox Content="{x:Static res:Resources.IsMergingByHash}" IsChecked="{Binding Options.IsMergingByHash}" Margin="3"/>
<TextBlock Text="{x:Static res:Resources.IsMergingByHashDescription}" Style="{StaticResource Description}"/>
<CheckBox Content="{x:Static res:Resources.IsSkippingAutoProps}" IsChecked="{Binding Options.IsSkippingAutoProps}" Margin="3"/>
<TextBlock Text="{x:Static res:Resources.IsSkippingAutoPropsDescription}" Style="{StaticResource Description}"/>

<!-- Output directories -->
<Label Content="{x:Static res:Resources.OutputDirectories}" Style="{StaticResource Header}"/>
Expand Down
6 changes: 6 additions & 0 deletions AxoCover/app.config
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,12 @@
<setting name="TestSettings" serializeAs="String">
<value />
</setting>
<setting name="IsMergingByHash" serializeAs="String">
<value>True</value>
</setting>
<setting name="IsSkippingAutoProps" serializeAs="String">
<value>True</value>
</setting>
</AxoCover.Properties.Settings>
</userSettings>
<applicationSettings>
Expand Down
2 changes: 1 addition & 1 deletion AxoCover/source.extension.vsixmanifest
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<PackageManifest Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2011" xmlns:d="http://schemas.microsoft.com/developer/vsx-schema-design/2011">
<Metadata>
<Identity Id="26901782-38e1-48d4-94e9-557d44db052e" Version="1.1.0.37" Language="en-US" Publisher="Péter Major" />
<Identity Id="26901782-38e1-48d4-94e9-557d44db052e" Version="1.1.0.38" Language="en-US" Publisher="Péter Major" />
<DisplayName>AxoCover</DisplayName>
<Description xml:space="preserve">Nice and free .Net code coverage support for Visual Studio with OpenCover.</Description>
<MoreInfo>https://marketplace.visualstudio.com/items?itemName=axodox1.AxoCover</MoreInfo>
Expand Down

0 comments on commit 73827e7

Please sign in to comment.