From a0c88b35262cfccf0b7e89712256e73632f798a0 Mon Sep 17 00:00:00 2001 From: Martin Bjorkstrom Date: Fri, 26 Feb 2016 23:16:50 +0200 Subject: [PATCH] Added DotCover Cover command --- .../Cake.Common.Tests.csproj | 2 + .../Analyse/DotCoverAnalyserFixture.cs | 1 - .../DotCover/Cover/DotCoverCovererFixture.cs | 53 ++++ .../DotCover/Cover/DotCoverCovererTests.cs | 266 ++++++++++++++++++ src/Cake.Common/Cake.Common.csproj | 5 +- .../Analyse/DotCoverAnalyseSettings.cs | 54 +--- .../DotCover/Cover/DotCoverCoverSettings.cs | 20 ++ .../Tools/DotCover/Cover/DotCoverCoverer.cs | 146 ++++++++++ .../Tools/DotCover/DotCoverAliases.cs | 51 ++++ .../Tools/DotCover/DotCoverSettings.cs | 70 +++++ ...sions.cs => DotCoverSettingsExtensions.cs} | 21 +- 11 files changed, 626 insertions(+), 63 deletions(-) create mode 100644 src/Cake.Common.Tests/Fixtures/Tools/DotCover/Cover/DotCoverCovererFixture.cs create mode 100644 src/Cake.Common.Tests/Unit/Tools/DotCover/Cover/DotCoverCovererTests.cs create mode 100644 src/Cake.Common/Tools/DotCover/Cover/DotCoverCoverSettings.cs create mode 100644 src/Cake.Common/Tools/DotCover/Cover/DotCoverCoverer.cs create mode 100644 src/Cake.Common/Tools/DotCover/DotCoverSettings.cs rename src/Cake.Common/Tools/DotCover/{Analyse/DotCoverAnalyseSettingsExtensions.cs => DotCoverSettingsExtensions.cs} (53%) diff --git a/src/Cake.Common.Tests/Cake.Common.Tests.csproj b/src/Cake.Common.Tests/Cake.Common.Tests.csproj index 127394ed82..32b8e566d1 100644 --- a/src/Cake.Common.Tests/Cake.Common.Tests.csproj +++ b/src/Cake.Common.Tests/Cake.Common.Tests.csproj @@ -94,6 +94,7 @@ + @@ -209,6 +210,7 @@ + diff --git a/src/Cake.Common.Tests/Fixtures/Tools/DotCover/Analyse/DotCoverAnalyserFixture.cs b/src/Cake.Common.Tests/Fixtures/Tools/DotCover/Analyse/DotCoverAnalyserFixture.cs index fcc74850f8..15a64ff9a1 100644 --- a/src/Cake.Common.Tests/Fixtures/Tools/DotCover/Analyse/DotCoverAnalyserFixture.cs +++ b/src/Cake.Common.Tests/Fixtures/Tools/DotCover/Analyse/DotCoverAnalyserFixture.cs @@ -3,7 +3,6 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -using Cake.Common.Tools.DNU.Build; using Cake.Common.Tools.DotCover.Analyse; using Cake.Core; using Cake.Core.Diagnostics; diff --git a/src/Cake.Common.Tests/Fixtures/Tools/DotCover/Cover/DotCoverCovererFixture.cs b/src/Cake.Common.Tests/Fixtures/Tools/DotCover/Cover/DotCoverCovererFixture.cs new file mode 100644 index 0000000000..39b0d48c66 --- /dev/null +++ b/src/Cake.Common.Tests/Fixtures/Tools/DotCover/Cover/DotCoverCovererFixture.cs @@ -0,0 +1,53 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Cake.Common.Tools.DotCover.Cover; +using Cake.Core; +using Cake.Core.Diagnostics; +using Cake.Core.IO; +using NSubstitute; + +namespace Cake.Common.Tests.Fixtures.Tools.DotCover.Cover +{ + internal sealed class DotCoverCovererFixture : DotCoverFixture + { + public ICakeContext Context { get; set; } + public Action Action { get; set; } + public FilePath OutputPath { get; set; } + + public DotCoverCovererFixture() + { + // Set the output file. + OutputPath = new FilePath("./result.dcvr"); + + // Setup the Cake Context. + Context = Substitute.For(); + Context.FileSystem.Returns(FileSystem); + Context.Arguments.Returns(Substitute.For()); + Context.Environment.Returns(Environment); + Context.Globber.Returns(Globber); + Context.Log.Returns(Substitute.For()); + Context.Registry.Returns(Substitute.For()); + Context.ProcessRunner.Returns((IProcessRunner)null); + + // Set up the default action that intercepts. + Action = context => + { + context.ProcessRunner.Start( + new FilePath("/Working/tools/Test.exe"), + new ProcessSettings() + { + Arguments = "-argument" + }); + }; + } + + protected override void RunTool() + { + var tool = new DotCoverCoverer(FileSystem, Environment, ProcessRunner, Globber); + tool.Cover(Context, Action, OutputPath, Settings); + } + } +} diff --git a/src/Cake.Common.Tests/Unit/Tools/DotCover/Cover/DotCoverCovererTests.cs b/src/Cake.Common.Tests/Unit/Tools/DotCover/Cover/DotCoverCovererTests.cs new file mode 100644 index 0000000000..ce37236482 --- /dev/null +++ b/src/Cake.Common.Tests/Unit/Tools/DotCover/Cover/DotCoverCovererTests.cs @@ -0,0 +1,266 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Cake.Common.Tests.Fixtures.Tools.DotCover; +using Cake.Common.Tests.Fixtures.Tools.DotCover.Cover; +using Cake.Common.Tools.DotCover; +using Cake.Common.Tools.DotCover.Cover; +using Cake.Common.Tools.NUnit; +using Cake.Common.Tools.XUnit; +using Cake.Core.IO; +using Cake.Testing; +using Xunit; + +namespace Cake.Common.Tests.Unit.Tools.DotCover.Cover +{ + public sealed class DotCoverCovererTests + { + public sealed class TheCoverMethod + { + [Fact] + public void Should_Throw_If_Context_Is_Null() + { + // Given + var fixture = new DotCoverCovererFixture(); + fixture.Context = null; + + // When + var result = Record.Exception(() => fixture.Run()); + + // Then + Assert.IsArgumentNullException(result, "context"); + } + + [Fact] + public void Should_Throw_If_Action_Is_Null() + { + // Given + var fixture = new DotCoverCovererFixture(); + fixture.Action = null; + + // When + var result = Record.Exception(() => fixture.Run()); + + // Then + Assert.IsArgumentNullException(result, "action"); + + } + + [Fact] + public void Should_Throw_If_Output_File_Is_Null() + { + // Given + var fixture = new DotCoverCovererFixture(); + fixture.OutputPath = null; + + // When + var result = Record.Exception(() => fixture.Run()); + + // Then + Assert.IsArgumentNullException(result, "outputPath"); + } + + [Fact] + public void Should_Throw_If_Settings_Are_Null() + { + // Given + var fixture = new DotCoverCovererFixture(); + fixture.Settings = null; + + // When + var result = Record.Exception(() => fixture.Run()); + + // Then + Assert.IsArgumentNullException(result, "settings"); + } + + [Fact] + public void Should_Throw_If_No_Tool_Was_Intercepted() + { + // Given + var fixture = new DotCoverCovererFixture(); + fixture.Action = context => { }; + + // When + var result = Record.Exception(() => fixture.Run()); + + // Then + Assert.IsCakeException(result, "No tool was started."); + } + + [Fact] + public void Should_Capture_Tool_And_Arguments_From_Action() + { + // Given + var fixture = new DotCoverCovererFixture(); + + // When + var result = fixture.Run(); + + // Then + Assert.Equal("Cover /TargetExecutable=\"/Working/tools/Test.exe\" " + + "/TargetArguments=\"-argument\" " + + "/Output=\"/Working/result.dcvr\"", result.Args); + } + + [Theory] + [InlineData("")] + [InlineData(null)] + public void Should_Not_Capture_Arguments_From_Action_If_Excluded(string arguments) + { + // Given + var fixture = new DotCoverCovererFixture(); + fixture.Action = context => + { + context.ProcessRunner.Start( + new FilePath("/Working/tools/Test.exe"), + new ProcessSettings() + { + Arguments = arguments + }); + }; + + // When + var result = fixture.Run(); + + // Then + Assert.Equal("Cover /TargetExecutable=\"/Working/tools/Test.exe\" " + + "/Output=\"/Working/result.dcvr\"", result.Args); + } + + [Fact] + public void Should_Append_TargetWorkingDir() + { + // Given + var fixture = new DotCoverCovererFixture(); + fixture.Settings.TargetWorkingDir = new DirectoryPath("/Working"); + + // When + var result = fixture.Run(); + + // Then + Assert.Equal("Cover /TargetExecutable=\"/Working/tools/Test.exe\" " + + "/TargetArguments=\"-argument\" " + + "/Output=\"/Working/result.dcvr\" " + + "/TargetWorkingDir=\"/Working\"", result.Args); + } + + [Fact] + public void Should_Append_Scope() + { + // Given + var fixture = new DotCoverCovererFixture(); + fixture.Settings.WithScope("/Working/*.dll") + .WithScope("/Some/**/Other/*.dll"); + + // When + var result = fixture.Run(); + + // Then + Assert.Equal("Cover /TargetExecutable=\"/Working/tools/Test.exe\" " + + "/TargetArguments=\"-argument\" " + + "/Output=\"/Working/result.dcvr\" " + + "/Scope=\"/Working/*.dll;/Some/**/Other/*.dll\"", result.Args); + } + + [Fact] + public void Should_Append_Filters() + { + // Given + var fixture = new DotCoverCovererFixture(); + fixture.Settings.WithFilter("+:module=Test.*") + .WithFilter("-:myassembly"); + + // When + var result = fixture.Run(); + + // Then + Assert.Equal("Cover /TargetExecutable=\"/Working/tools/Test.exe\" " + + "/TargetArguments=\"-argument\" " + + "/Output=\"/Working/result.dcvr\" " + + "/Filters=\"+:module=Test.*;-:myassembly\"", result.Args); + } + + [Fact] + public void Should_Append_AttributeFilters() + { + // Given + var fixture = new DotCoverCovererFixture(); + fixture.Settings.WithAttributeFilter("filter1") + .WithAttributeFilter("filter2"); + + // When + var result = fixture.Run(); + + // Then + Assert.Equal("Cover /TargetExecutable=\"/Working/tools/Test.exe\" " + + "/TargetArguments=\"-argument\" " + + "/Output=\"/Working/result.dcvr\" " + + "/AttributeFilters=\"filter1;filter2\"", result.Args); + } + + [Fact] + public void Should_Append_DisableDefaultFilters() + { + // Given + var fixture = new DotCoverCovererFixture(); + fixture.Settings.DisableDefaultFilters = true; + + // When + var result = fixture.Run(); + + // Then + Assert.Equal("Cover /TargetExecutable=\"/Working/tools/Test.exe\" " + + "/TargetArguments=\"-argument\" " + + "/Output=\"/Working/result.dcvr\" " + + "/DisableDefaultFilters", result.Args); + } + + [Fact] + public void Should_Capture_XUnit() + { + // Given + var fixture = new DotCoverCovererFixture(); + fixture.FileSystem.CreateFile("/Working/tools/xunit.console.exe"); + fixture.Action = context => + { + context.XUnit2( + new FilePath[] { "./Test.dll" }, + new XUnit2Settings { ShadowCopy = false }); + }; + + // When + var result = fixture.Run(); + + // Then + Assert.Equal("Cover /TargetExecutable=\"/Working/tools/xunit.console.exe\" " + + "/TargetArguments=\"\\\"/Working/Test.dll\\\" -noshadow\" " + + "/Output=\"/Working/result.dcvr\"", result.Args); + } + + [Fact] + public void Should_Capture_NUnit() + { + // Given + var fixture = new DotCoverCovererFixture(); + fixture.FileSystem.CreateFile("/Working/tools/nunit-console.exe"); + fixture.Action = context => + { + context.NUnit( + new FilePath[] { "./Test.dll" }, + new NUnitSettings { ShadowCopy = false }); + }; + + // When + var result = fixture.Run(); + + // Then + Assert.Equal("Cover /TargetExecutable=\"/Working/tools/nunit-console.exe\" " + + "/TargetArguments=\"\\\"/Working/Test.dll\\\" -noshadow\" " + + "/Output=\"/Working/result.dcvr\"", result.Args); + } + } + } +} diff --git a/src/Cake.Common/Cake.Common.csproj b/src/Cake.Common/Cake.Common.csproj index 40650b0be6..6fca1ffad7 100644 --- a/src/Cake.Common/Cake.Common.csproj +++ b/src/Cake.Common/Cake.Common.csproj @@ -166,12 +166,15 @@ - + + + + diff --git a/src/Cake.Common/Tools/DotCover/Analyse/DotCoverAnalyseSettings.cs b/src/Cake.Common/Tools/DotCover/Analyse/DotCoverAnalyseSettings.cs index 54eef4add0..cbf49a4a13 100644 --- a/src/Cake.Common/Tools/DotCover/Analyse/DotCoverAnalyseSettings.cs +++ b/src/Cake.Common/Tools/DotCover/Analyse/DotCoverAnalyseSettings.cs @@ -9,12 +9,8 @@ namespace Cake.Common.Tools.DotCover.Analyse /// /// Contains settings used by . /// - public sealed class DotCoverAnalyseSettings : ToolSettings + public sealed class DotCoverAnalyseSettings : DotCoverSettings { - private readonly HashSet _scope; - private readonly HashSet _filters; - private readonly HashSet _attributeFilters; - /// /// Gets or sets the type of the report. /// This represents the /ReportType option. @@ -22,57 +18,11 @@ public sealed class DotCoverAnalyseSettings : ToolSettings /// public DotCoverReportType ReportType { get; set; } - /// - /// Gets or sets program working directory - /// This represents the /TargetWorkingDir option. - /// - public DirectoryPath TargetWorkingDir { get; set; } - - /// - /// Gets the assemblies loaded in the specified scope into coverage results. - /// Ant-style patterns are supported here (e.g.ProjectFolder/**/*.dll) - /// This represents the /Scope option. - /// - public ISet Scope - { - get { return _scope; } - } - - /// - /// Gets the coverage filters using the following syntax: +:module=*;class=*;function=*; - /// Use -:myassembly to exclude an assembly from code coverage. - /// Asterisk wildcard (*) is supported here. - /// This represents the /Filters option. - /// - public ISet Filters - { - get { return _filters; } - } - - /// - /// Gets the attribute filters using the following syntax: filter1;filter2;... - /// Asterisk wildcard(*) is supported here - /// This represents the /AttributeFilters option. - /// - public ISet AttributeFilters - { - get { return _attributeFilters; } - } - - /// - /// Gets or sets a value indicating whether the default (automatically added) filters should be disabled - /// This represents the /DisableDefaultFilters option. - /// - public bool DisableDefaultFilters { get; set; } - /// /// Initializes a new instance of the class. /// - public DotCoverAnalyseSettings() + public DotCoverAnalyseSettings() : base() { - _scope = new HashSet(StringComparer.Ordinal); - _filters = new HashSet(StringComparer.OrdinalIgnoreCase); - _attributeFilters = new HashSet(StringComparer.OrdinalIgnoreCase); } } } \ No newline at end of file diff --git a/src/Cake.Common/Tools/DotCover/Cover/DotCoverCoverSettings.cs b/src/Cake.Common/Tools/DotCover/Cover/DotCoverCoverSettings.cs new file mode 100644 index 0000000000..e878258431 --- /dev/null +++ b/src/Cake.Common/Tools/DotCover/Cover/DotCoverCoverSettings.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using Cake.Core.IO; +using Cake.Core.Tooling; + +namespace Cake.Common.Tools.DotCover.Cover +{ + /// + /// Contains settings used by . + /// + public sealed class DotCoverCoverSettings : DotCoverSettings + { + /// + /// Initializes a new instance of the class. + /// + public DotCoverCoverSettings() : base() + { + } + } +} \ No newline at end of file diff --git a/src/Cake.Common/Tools/DotCover/Cover/DotCoverCoverer.cs b/src/Cake.Common/Tools/DotCover/Cover/DotCoverCoverer.cs new file mode 100644 index 0000000000..611d05562a --- /dev/null +++ b/src/Cake.Common/Tools/DotCover/Cover/DotCoverCoverer.cs @@ -0,0 +1,146 @@ +using System; +using Cake.Core; +using Cake.Core.IO; + +namespace Cake.Common.Tools.DotCover.Cover +{ + /// + /// DotCover Coverer builder. + /// + public sealed class DotCoverCoverer : DotCoverTool + { + private readonly ICakeEnvironment _environment; + + /// + /// Initializes a new instance of the class. + /// + /// The file system. + /// The environment. + /// The process runner. + /// The globber. + public DotCoverCoverer( + IFileSystem fileSystem, + ICakeEnvironment environment, + IProcessRunner processRunner, + IGlobber globber) + : base(fileSystem, environment, processRunner, globber) + { + _environment = environment; + } + + /// + /// Runs DotCover Cover with the specified settings. + /// + /// The context. + /// The action. + /// The output file path. + /// The settings. + public void Cover(ICakeContext context, + Action action, + FilePath outputPath, + DotCoverCoverSettings settings) + { + if (context == null) + { + throw new ArgumentNullException("context"); + } + if (action == null) + { + throw new ArgumentNullException("action"); + } + if (outputPath == null) + { + throw new ArgumentNullException("outputPath"); + } + if (settings == null) + { + throw new ArgumentNullException("settings"); + } + + // Run the tool using the interceptor. + var interceptor = InterceptAction(context, action); + + // Run the tool. + Run(settings, GetArguments(interceptor, settings, outputPath)); + } + + private static DotCoverContext InterceptAction( + ICakeContext context, + Action action) + { + var interceptor = new DotCoverContext(context); + action(interceptor); + + // Validate arguments. + if (interceptor.FilePath == null) + { + throw new CakeException("No tool was started."); + } + + return interceptor; + } + + private ProcessArgumentBuilder GetArguments( + DotCoverContext context, + DotCoverCoverSettings settings, + FilePath outputPath) + { + var builder = new ProcessArgumentBuilder(); + + builder.Append("Cover"); + + // The target application to call. + builder.AppendSwitch("/TargetExecutable", "=", context.FilePath.FullPath.Quote()); + + // The arguments to the target application. + if (context.Settings != null && context.Settings.Arguments != null) + { + var arguments = context.Settings.Arguments.Render(); + if (!string.IsNullOrWhiteSpace(arguments)) + { + arguments = arguments.Replace("\"", "\\\""); + builder.AppendSwitch("/TargetArguments", "=", arguments.Quote()); + } + } + + // Set the output file. + outputPath = outputPath.MakeAbsolute(_environment); + builder.AppendSwitch("/Output", "=", outputPath.FullPath.Quote()); + + // TargetWorkingDir + if (settings.TargetWorkingDir != null) + { + builder.AppendSwitch("/TargetWorkingDir", "=", settings.TargetWorkingDir.MakeAbsolute(_environment).FullPath.Quote()); + } + + // Scope + if (settings.Scope.Count > 0) + { + var scope = string.Join(";", settings.Scope); + builder.AppendSwitch("/Scope", "=", scope.Quote()); + } + + // Filters + if (settings.Filters.Count > 0) + { + var filters = string.Join(";", settings.Filters); + builder.AppendSwitch("/Filters", "=", filters.Quote()); + } + + // Filters + if (settings.AttributeFilters.Count > 0) + { + var attributeFilters = string.Join(";", settings.AttributeFilters); + builder.AppendSwitch("/AttributeFilters", "=", attributeFilters.Quote()); + } + + // DisableDefaultFilters + if (settings.DisableDefaultFilters) + { + builder.Append("/DisableDefaultFilters"); + } + + return builder; + } + } +} \ No newline at end of file diff --git a/src/Cake.Common/Tools/DotCover/DotCoverAliases.cs b/src/Cake.Common/Tools/DotCover/DotCoverAliases.cs index 5b58b9630f..126d97661a 100644 --- a/src/Cake.Common/Tools/DotCover/DotCoverAliases.cs +++ b/src/Cake.Common/Tools/DotCover/DotCoverAliases.cs @@ -1,5 +1,6 @@ using System; using Cake.Common.Tools.DotCover.Analyse; +using Cake.Common.Tools.DotCover.Cover; using Cake.Core; using Cake.Core.Annotations; using Cake.Core.IO; @@ -61,5 +62,55 @@ public static void DotCoverAnalyse( // Run DotCover analyse. analyser.Analyse(context, action, outputFile, settings); } + + /// + /// Runs DotCover Cover + /// for the specified action and settings. + /// + /// The context. + /// The action to run DotCover for. + /// The DotCover output file. + /// The settings. + /// + /// + /// DotCoverCover(tool => { + /// tool.XUnit2("./**/App.Tests.dll", + /// new XUnit2Settings { + /// ShadowCopy = false + /// }); + /// }, + /// new FilePath("./result.dcvr"), + /// new DotCoverCoverSettings() + /// .WithFilter("+:App") + /// .WithFilter("-:App.Tests")); + /// + /// + [CakeMethodAlias] + [CakeAliasCategory("Cover")] + [CakeNamespaceImport("Cake.Common.Tools.DotCover.Cover")] + public static void DotCoverCover( + this ICakeContext context, + Action action, + FilePath outputFile, + DotCoverCoverSettings settings) + { + if (context == null) + { + throw new ArgumentNullException("context"); + } + + if (settings == null) + { + settings = new DotCoverCoverSettings(); + } + + // Create the DotCover coverer. + var coverer = new DotCoverCoverer( + context.FileSystem, context.Environment, + context.ProcessRunner, context.Globber); + + // Run DotCover cover. + coverer.Cover(context, action, outputFile, settings); + } } } \ No newline at end of file diff --git a/src/Cake.Common/Tools/DotCover/DotCoverSettings.cs b/src/Cake.Common/Tools/DotCover/DotCoverSettings.cs new file mode 100644 index 0000000000..a03685f6ea --- /dev/null +++ b/src/Cake.Common/Tools/DotCover/DotCoverSettings.cs @@ -0,0 +1,70 @@ +using System; +using System.Collections.Generic; +using Cake.Core.IO; +using Cake.Core.Tooling; + +namespace Cake.Common.Tools.DotCover +{ + /// + /// Contains settings used by . + /// + public abstract class DotCoverSettings : ToolSettings + { + private readonly HashSet _scope; + private readonly HashSet _filters; + private readonly HashSet _attributeFilters; + + /// + /// Gets or sets program working directory + /// This represents the /TargetWorkingDir option. + /// + public DirectoryPath TargetWorkingDir { get; set; } + + /// + /// Gets the assemblies loaded in the specified scope into coverage results. + /// Ant-style patterns are supported here (e.g.ProjectFolder/**/*.dll) + /// This represents the /Scope option. + /// + public ISet Scope + { + get { return _scope; } + } + + /// + /// Gets the coverage filters using the following syntax: +:module=*;class=*;function=*; + /// Use -:myassembly to exclude an assembly from code coverage. + /// Asterisk wildcard (*) is supported here. + /// This represents the /Filters option. + /// + public ISet Filters + { + get { return _filters; } + } + + /// + /// Gets the attribute filters using the following syntax: filter1;filter2;... + /// Asterisk wildcard(*) is supported here + /// This represents the /AttributeFilters option. + /// + public ISet AttributeFilters + { + get { return _attributeFilters; } + } + + /// + /// Gets or sets a value indicating whether the default (automatically added) filters should be disabled + /// This represents the /DisableDefaultFilters option. + /// + public bool DisableDefaultFilters { get; set; } + + /// + /// Initializes a new instance of the class. + /// + protected DotCoverSettings() + { + _scope = new HashSet(StringComparer.Ordinal); + _filters = new HashSet(StringComparer.OrdinalIgnoreCase); + _attributeFilters = new HashSet(StringComparer.OrdinalIgnoreCase); + } + } +} \ No newline at end of file diff --git a/src/Cake.Common/Tools/DotCover/Analyse/DotCoverAnalyseSettingsExtensions.cs b/src/Cake.Common/Tools/DotCover/DotCoverSettingsExtensions.cs similarity index 53% rename from src/Cake.Common/Tools/DotCover/Analyse/DotCoverAnalyseSettingsExtensions.cs rename to src/Cake.Common/Tools/DotCover/DotCoverSettingsExtensions.cs index 15f3eae356..58f177a63b 100644 --- a/src/Cake.Common/Tools/DotCover/Analyse/DotCoverAnalyseSettingsExtensions.cs +++ b/src/Cake.Common/Tools/DotCover/DotCoverSettingsExtensions.cs @@ -1,19 +1,20 @@ using System; -namespace Cake.Common.Tools.DotCover.Analyse +namespace Cake.Common.Tools.DotCover { /// - /// Contains extensions for . + /// Contains extensions for . /// - public static class DotCoverAnalyseSettingsExtensions + public static class DotCoverSettingsExtensions { /// /// Adds the scope. /// /// The settings. /// The scope. - /// The same instance so that multiple calls can be chained. - public static DotCoverAnalyseSettings WithScope(this DotCoverAnalyseSettings settings, string scope) + /// The settings type, derived from + /// The same instance so that multiple calls can be chained. + public static T WithScope(this T settings, string scope) where T : DotCoverSettings { if (settings == null) { @@ -28,8 +29,9 @@ public static DotCoverAnalyseSettings WithScope(this DotCoverAnalyseSettings set /// /// The settings. /// The filter. - /// The same instance so that multiple calls can be chained. - public static DotCoverAnalyseSettings WithFilter(this DotCoverAnalyseSettings settings, string filter) + /// The settings type, derived from + /// The same instance so that multiple calls can be chained. + public static T WithFilter(this T settings, string filter) where T : DotCoverSettings { if (settings == null) { @@ -44,8 +46,9 @@ public static DotCoverAnalyseSettings WithFilter(this DotCoverAnalyseSettings se /// /// The settings. /// The filter. - /// The same instance so that multiple calls can be chained. - public static DotCoverAnalyseSettings WithAttributeFilter(this DotCoverAnalyseSettings settings, string attributeFilter) + /// The settings type, derived from + /// The same instance so that multiple calls can be chained. + public static T WithAttributeFilter(this T settings, string attributeFilter) where T : DotCoverSettings { if (settings == null) {