diff --git a/.editorconfig b/.editorconfig
index 80bbc18..df01e97 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -21,4 +21,3 @@ tab_width = 4
[*.{*proj,xml,props,targets,tasks,yml,yaml}]
indent_size = 2
tab_width = 2
-
diff --git a/Directory.Build.props b/Directory.Build.props
index c4d6407..d8d0081 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -9,10 +9,18 @@
$(NoWarn);SA1311;SA1413
- $(NoWarn);SA0001;SA1600
<_SkipUpgradeNetAnalyzersNuGetWarning>true
+
+ $(NoWarn);SA0001;SA1600
+
+
+
+ $(NoWarn);CA1711
+ $(NoWarn);IL2026
+
+
diff --git a/docs/themes/book b/docs/themes/book
index d5b75f4..036e037 160000
--- a/docs/themes/book
+++ b/docs/themes/book
@@ -1 +1 @@
-Subproject commit d5b75f4fb3aaa5c2f0209db4933a55aa634d5dfd
+Subproject commit 036e037a63ba06ca366adb1a0c3a005d1a0b15b8
diff --git a/global.json b/global.json
index d2745f8..4875c6b 100644
--- a/global.json
+++ b/global.json
@@ -3,9 +3,9 @@
"allowPrerelease": false
},
"tools": {
- "dotnet": "7.0.100"
+ "dotnet": "7.0.202"
},
"msbuild-sdks": {
- "MsBullet.Sdk": "0.6.3"
+ "MsBullet.Sdk": "0.6.5"
}
}
diff --git a/src/Common/MockEngine.cs b/src/Common/MockEngine.cs
index 1e86968..1016513 100644
--- a/src/Common/MockEngine.cs
+++ b/src/Common/MockEngine.cs
@@ -3,14 +3,13 @@
using System.Collections;
using System.Collections.Generic;
using System.Linq;
-
using Microsoft.Build.Framework;
using Xunit.Abstractions;
using Xunit.Sdk;
namespace MsBullet.Sdk.IntegrationTests.Utilities
{
- internal class MockEngine : IBuildEngine5
+ internal sealed class MockEngine : IBuildEngine5
{
private readonly ITestOutputHelper output;
diff --git a/src/Common/Sandbox.cs b/src/Common/Sandbox.cs
index bbbc035..99fbbdf 100644
--- a/src/Common/Sandbox.cs
+++ b/src/Common/Sandbox.cs
@@ -21,7 +21,7 @@ public Sandbox(string workDir, string[] sourceDirectories)
foreach (string dir in sourceDirectories)
{
- this.CopyRecursive(dir, workDir);
+ Sandbox.CopyRecursive(dir, workDir);
}
}
@@ -52,15 +52,11 @@ protected virtual void Dispose(bool disposing)
}
}
- private void CopyRecursive(string srcDir, string destDir)
+ private static void CopyRecursive(string srcDir, string destDir)
{
foreach (string srcFileName in Directory.EnumerateFiles(srcDir, "*", SearchOption.AllDirectories))
{
- string destFileName = Path.Combine(destDir, srcFileName.Substring(srcDir.Length).TrimStart(new[]
- {
- Path.AltDirectorySeparatorChar,
- Path.DirectorySeparatorChar
- }));
+ string destFileName = Path.Combine(destDir, srcFileName.Substring(srcDir.Length).TrimStart(Path.AltDirectorySeparatorChar, Path.DirectorySeparatorChar));
Directory.CreateDirectory(Path.GetDirectoryName(destFileName));
File.Copy(srcFileName, destFileName);
diff --git a/src/MsBullet.Sdk.IntegrationTests/MinimalRepoTests.cs b/src/MsBullet.Sdk.IntegrationTests/MinimalRepoTests.cs
index 455ddac..0157bc7 100644
--- a/src/MsBullet.Sdk.IntegrationTests/MinimalRepoTests.cs
+++ b/src/MsBullet.Sdk.IntegrationTests/MinimalRepoTests.cs
@@ -42,7 +42,6 @@ public void MinimalRepoBuildsWithoutErrors()
public void MinimalRepoPackWithoutErrors(bool isShippable, string destinationFolder)
{
// Given
-#pragma warning disable CA2000 // Dispose objects before losing scope
TestApp app = this.fixture.ProvideTestApp("MinimalRepo")
.WithPreCreate("git", "init")
.WithPreCreate("git", "remote", "add", "origin", "http://localhost")
@@ -50,7 +49,6 @@ public void MinimalRepoPackWithoutErrors(bool isShippable, string destinationFol
.WithPreCreate("git", "commit", "--allow-empty", "-m", "Dummy happy empty commit.")
.Create(this.output);
-#pragma warning restore CA2000 // Dispose objects before losing scope
var expectedVersion = "1.0.0-local.*";
var packageFileName = $"ClassLib1.{expectedVersion}.nupkg";
@@ -66,20 +64,11 @@ public void MinimalRepoPackWithoutErrors(bool isShippable, string destinationFol
Assert.Single(Directory.GetFiles(Path.Combine(app.WorkingDirectory, "artifacts", "packages", "Debug", destinationFolder), packageFileName));
}
- [Fact]
+ [Fact(Skip = "This feature will be released on future version")]
public void MinimalRepoSignsWithoutErrors()
{
-#pragma warning disable CA1303 // Do not pass literals as localized parameters
- this.output.WriteLine("This feature will be released on future version");
-#pragma warning restore CA1303 // Do not pass literals as localized parameters
- return;
-
-#pragma warning disable CS0162 // Unreachable code detected
-
// Given
-#pragma warning disable CA2000 // Dispose objects before losing scope
TestApp app = this.fixture.ProvideTestApp("MinimalRepo").Create(this.output);
-#pragma warning restore CA2000 // Dispose objects before losing scope
// When
int exitCode = app.ExecuteBuild(
@@ -98,16 +87,13 @@ public void MinimalRepoSignsWithoutErrors()
#pragma warning disable SYSLIB0024 // Type or member is obsolete
AppDomain.Unload(domain);
#pragma warning restore SYSLIB0024 // Type or member is obsolete
-#pragma warning restore CS0162 // Unreachable code detected
}
[Fact]
public void MinimalRepoVersionWithoutErrors()
{
// Given
-#pragma warning disable CA2000 // Dispose objects before losing scope
TestApp app = this.fixture.ProvideTestApp("MinimalRepo").Create(this.output);
-#pragma warning restore CA2000 // Dispose objects before losing scope
// When
int exitCode = app.ExecuteBuild(
diff --git a/src/MsBullet.Sdk.IntegrationTests/MinimalRepoWithTestsTests.cs b/src/MsBullet.Sdk.IntegrationTests/MinimalRepoWithTestsTests.cs
index afb7e7c..a545696 100644
--- a/src/MsBullet.Sdk.IntegrationTests/MinimalRepoWithTestsTests.cs
+++ b/src/MsBullet.Sdk.IntegrationTests/MinimalRepoWithTestsTests.cs
@@ -19,6 +19,21 @@ public MinimalRepoWithTestsTests(ITestOutputHelper output, TestProjectFixture fi
this.fixture = fixture;
}
+ [Fact]
+ public void MinimalRepoBuildsWithoutErrors()
+ {
+ // Given
+#pragma warning disable CA2000 // Dispose objects before losing scope.
+ TestApp app = this.fixture.ProvideTestApp("MinimalRepoWithTests").Create(this.output);
+#pragma warning restore CA2000 // Dispose objects before losing scope
+
+ // When
+ int exitCode = app.ExecuteBuild(this.output);
+
+ // Then
+ Assert.Equal(0, exitCode);
+ }
+
[Fact]
public void MinimalRepoRunTestsWithoutError()
{
@@ -58,7 +73,7 @@ public void MinimalRepoRunTestsShoudProduceTestsResults(string configuration, st
Assert.Equal(0, exitCode);
Assert.True(Directory.Exists(outDir));
- var outDirPahts = Directory.EnumerateFiles(outDir).Select(path => Path.GetFileName(path));
+ var outDirPahts = Directory.EnumerateFiles(outDir).Select(Path.GetFileName);
foreach (var report in reports)
{
Assert.Contains(report, outDirPahts);
@@ -86,7 +101,7 @@ public void MinimalRepoRunTestsShoudProduceLogResults(string configuration, stri
// Then
Assert.Equal(0, exitCode);
Assert.True(Directory.Exists(outDir));
- Assert.Contains(fileName, Directory.EnumerateFiles(outDir).Select(path => Path.GetFileName(path)));
+ Assert.Contains(fileName, Directory.EnumerateFiles(outDir).Select(Path.GetFileName));
}
[Theory]
@@ -108,7 +123,7 @@ public void MinimalRepoRunTestsShoudCollectCoverageMetrics(string configuration,
// Then
Assert.Equal(0, exitCode);
Assert.True(Directory.Exists(outDir));
- Assert.Contains(fileName, Directory.EnumerateFiles(outDir).Select(path => Path.GetFileName(path)));
+ Assert.Contains(fileName, Directory.EnumerateFiles(outDir).Select(Path.GetFileName));
}
[Theory]
@@ -131,7 +146,53 @@ public void MinimalRepoRunTestsShoudGenerateCoverageReports(string configuration
// Then
Assert.Equal(0, exitCode);
Assert.True(Directory.Exists(outDir));
- Assert.Contains(fileName, Directory.EnumerateFiles(outDir).Select(path => Path.GetFileName(path)));
+ Assert.Contains(fileName, Directory.EnumerateFiles(outDir).Select(Path.GetFileName));
+ }
+
+ [Theory]
+ [InlineData("Debug")]
+ [InlineData("Release")]
+ public void MinimalRepoRunTestsShoudNotGenerateCoverageSummaryReportsWhenItsPropertyIsFalse(string configuration)
+ {
+ // Given
+ TestApp app = this.fixture.ProvideTestApp("MinimalRepoWithTests").Create(this.output);
+ var outDir = Path.Combine(app.WorkingDirectory, "artifacts", "TestResults", configuration, "Reports");
+
+ // When
+ int exitCode = app.ExecuteBuild(
+ this.output,
+ "-test",
+ $"-configuration {configuration}",
+ "/p:GenerateCoverageReportSummary=false");
+
+ // Then
+ Assert.Equal(0, exitCode);
+ Assert.True(Directory.Exists(outDir));
+ Assert.DoesNotContain("Summary", Directory.EnumerateDirectories(outDir));
+ }
+
+ [Theory]
+ [InlineData("Debug")]
+ [InlineData("Release")]
+ public void MinimalRepoRunTestsShoudNotGenerateCoverageReportsWhenReportGeneratorToolIsOptedOut(string configuration)
+ {
+ // Given
+#pragma warning disable CA2000 // Dispose objects before losing scope
+ TestApp app = this.fixture.ProvideTestApp("MinimalRepoWithTests").Create(this.output);
+#pragma warning restore CA2000 // Dispose objects before losing scope
+ var outDir = Path.Combine(app.WorkingDirectory, "artifacts", "TestResults", configuration);
+
+ // When
+ int exitCode = app.ExecuteBuild(
+ this.output,
+ "-test",
+ $"-configuration {configuration}",
+ "/p:UsingToolReportGenerator=false");
+
+ // Then
+ Assert.Equal(0, exitCode);
+ Assert.True(Directory.Exists(outDir));
+ Assert.DoesNotContain("Reports", Directory.EnumerateDirectories(outDir));
}
[Theory]
diff --git a/src/MsBullet.Sdk.IntegrationTests/MultipleProjectsWithTestsTests.cs b/src/MsBullet.Sdk.IntegrationTests/MultipleProjectsWithTestsTests.cs
index 3807f5c..26237f4 100644
--- a/src/MsBullet.Sdk.IntegrationTests/MultipleProjectsWithTestsTests.cs
+++ b/src/MsBullet.Sdk.IntegrationTests/MultipleProjectsWithTestsTests.cs
@@ -1,5 +1,6 @@
// See the LICENSE.TXT file in the project root for full license information.
+using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Linq;
using Xunit;
@@ -24,7 +25,7 @@ public MultipleProjectsWithTestsTests(ITestOutputHelper output, TestProjectFixtu
[InlineData("Release", "", "index.html", "Summary.tex", "Cobertura.xml")]
[InlineData("Debug", "Html", "index.html", "Cobertura.xml")]
[InlineData("Release", "Html", "index.html", "Cobertura.xml")]
- public void MinimalRepoRunTestsShoudGenerateCoverageReportSummary(string configuration, string reportTypes, params string[] reports)
+ public void MinimalRepoRunTestsShoudGenerateCoverageReportSummary(string configuration, string reportTypes, [NotNull] params string[] reports)
{
// Given
TestApp app = this.fixture.ProvideTestApp("MultipleProjectsWithTests").Create(this.output);
@@ -57,7 +58,9 @@ public void MinimalRepoRunTestsShoudGenerateCoverageReportSummary(string configu
public void ShouldBeEvaluateReportCoverageOnlyWhenIsTestProject()
{
// Given
+#pragma warning disable CA2000 // Dispose objects before losing scope
TestApp app = this.fixture.ProvideTestApp("MultipleProjectsWithTests").Create(this.output);
+#pragma warning restore CA2000 // Dispose objects before losing scope
var args = new[]
{
"/t:CollectCoverage"
diff --git a/src/MsBullet.Sdk.IntegrationTests/Utilities/TestApp.cs b/src/MsBullet.Sdk.IntegrationTests/Utilities/TestApp.cs
index 6b23fa3..71d297c 100644
--- a/src/MsBullet.Sdk.IntegrationTests/Utilities/TestApp.cs
+++ b/src/MsBullet.Sdk.IntegrationTests/Utilities/TestApp.cs
@@ -72,7 +72,7 @@ void Write(object sender, DataReceivedEventArgs e)
psi.UseShellExecute = false;
psi.RedirectStandardError = true;
psi.RedirectStandardOutput = true;
- psi.Environment["PATH"] = Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName) + Path.PathSeparator + Environment.GetEnvironmentVariable("PATH");
+ psi.Environment["PATH"] = Path.GetDirectoryName(Environment.ProcessPath) + Path.PathSeparator + Environment.GetEnvironmentVariable("PATH");
var process = new Process
{
@@ -101,9 +101,7 @@ protected virtual int ExecuteScript(ITestOutputHelper output, string fileName, I
if (string.IsNullOrEmpty(fileName))
{
-#pragma warning disable CA1303 // Do not pass literals as localized parameters
throw new ArgumentException("Script file is not valorized.", nameof(fileName));
-#pragma warning restore CA1303 // Do not pass literals as localized parameters
}
if (scriptArgs is null)
@@ -148,11 +146,7 @@ private static void Copy(string srcDir, string destDir)
{
foreach (string srcFileName in Directory.EnumerateFiles(srcDir, "*", SearchOption.AllDirectories))
{
- string destFileName = Path.Combine(destDir, srcFileName.Substring(srcDir.Length).TrimStart(new[]
- {
- Path.AltDirectorySeparatorChar,
- Path.DirectorySeparatorChar
- }));
+ string destFileName = Path.Combine(destDir, srcFileName.Substring(srcDir.Length).TrimStart(Path.AltDirectorySeparatorChar, Path.DirectorySeparatorChar));
Directory.CreateDirectory(Path.GetDirectoryName(destFileName));
File.Copy(srcFileName, destFileName);
diff --git a/src/MsBullet.Sdk.IntegrationTests/Utilities/TestProjectFixture.cs b/src/MsBullet.Sdk.IntegrationTests/Utilities/TestProjectFixture.cs
index 0bfbbdc..546093c 100644
--- a/src/MsBullet.Sdk.IntegrationTests/Utilities/TestProjectFixture.cs
+++ b/src/MsBullet.Sdk.IntegrationTests/Utilities/TestProjectFixture.cs
@@ -50,7 +50,7 @@ protected virtual void Dispose(bool disposing)
{
if (disposing)
{
- while (this.disposables.Count > 0)
+ while (!this.disposables.IsEmpty)
{
if (this.disposables.TryDequeue(out IDisposable disposable))
{
diff --git a/src/MsBullet.Sdk.IntegrationTests/testassets/MinimalRepo/src/ClassLib1/ClassLib1.csproj b/src/MsBullet.Sdk.IntegrationTests/testassets/MinimalRepo/src/ClassLib1/ClassLib1.csproj
index 90646f8..bacb92c 100644
--- a/src/MsBullet.Sdk.IntegrationTests/testassets/MinimalRepo/src/ClassLib1/ClassLib1.csproj
+++ b/src/MsBullet.Sdk.IntegrationTests/testassets/MinimalRepo/src/ClassLib1/ClassLib1.csproj
@@ -4,6 +4,7 @@
netstandard2.0
$(NoWarn);SA0001;SA1633;SA1200
+ $(NoWarn);S2094
diff --git a/src/MsBullet.Sdk.IntegrationTests/testassets/MinimalRepoWithTests/src/ClassLib1.Tests/ClassLib1.Tests.csproj b/src/MsBullet.Sdk.IntegrationTests/testassets/MinimalRepoWithTests/src/ClassLib1.Tests/ClassLib1.Tests.csproj
index c3789d8..bf972d3 100644
--- a/src/MsBullet.Sdk.IntegrationTests/testassets/MinimalRepoWithTests/src/ClassLib1.Tests/ClassLib1.Tests.csproj
+++ b/src/MsBullet.Sdk.IntegrationTests/testassets/MinimalRepoWithTests/src/ClassLib1.Tests/ClassLib1.Tests.csproj
@@ -3,7 +3,7 @@
net7.0
- $(NoWarn);SA0001;SA1633;SA1200
+ $(NoWarn);SA0001;SA1633;SA1200;SA1600
diff --git a/src/MsBullet.Sdk.IntegrationTests/testassets/MinimalRepoWithTests/src/ClassLib1/ClassLib1.csproj b/src/MsBullet.Sdk.IntegrationTests/testassets/MinimalRepoWithTests/src/ClassLib1/ClassLib1.csproj
index 3b4a957..cc51340 100644
--- a/src/MsBullet.Sdk.IntegrationTests/testassets/MinimalRepoWithTests/src/ClassLib1/ClassLib1.csproj
+++ b/src/MsBullet.Sdk.IntegrationTests/testassets/MinimalRepoWithTests/src/ClassLib1/ClassLib1.csproj
@@ -5,7 +5,7 @@
true
- $(NoWarn);CA1822;SA0001;SA1633;SA1200;S3400
+ $(NoWarn);CA1822;SA0001;SA1633;SA1200;SA1600;S3400
diff --git a/src/MsBullet.Sdk.IntegrationTests/testassets/MultipleProjectsWithTests/src/ClassLib1.Tests/ClassLib1.Tests.csproj b/src/MsBullet.Sdk.IntegrationTests/testassets/MultipleProjectsWithTests/src/ClassLib1.Tests/ClassLib1.Tests.csproj
index c3789d8..bf972d3 100644
--- a/src/MsBullet.Sdk.IntegrationTests/testassets/MultipleProjectsWithTests/src/ClassLib1.Tests/ClassLib1.Tests.csproj
+++ b/src/MsBullet.Sdk.IntegrationTests/testassets/MultipleProjectsWithTests/src/ClassLib1.Tests/ClassLib1.Tests.csproj
@@ -3,7 +3,7 @@
net7.0
- $(NoWarn);SA0001;SA1633;SA1200
+ $(NoWarn);SA0001;SA1633;SA1200;SA1600
diff --git a/src/MsBullet.Sdk.IntegrationTests/testassets/MultipleProjectsWithTests/src/ClassLib1/ClassLib1.csproj b/src/MsBullet.Sdk.IntegrationTests/testassets/MultipleProjectsWithTests/src/ClassLib1/ClassLib1.csproj
index 3b4a957..cc51340 100644
--- a/src/MsBullet.Sdk.IntegrationTests/testassets/MultipleProjectsWithTests/src/ClassLib1/ClassLib1.csproj
+++ b/src/MsBullet.Sdk.IntegrationTests/testassets/MultipleProjectsWithTests/src/ClassLib1/ClassLib1.csproj
@@ -5,7 +5,7 @@
true
- $(NoWarn);CA1822;SA0001;SA1633;SA1200;S3400
+ $(NoWarn);CA1822;SA0001;SA1633;SA1200;SA1600;S3400
diff --git a/src/MsBullet.Sdk.IntegrationTests/testassets/MultipleProjectsWithTests/src/ClassLib2.Tests/ClassLib2.Tests.csproj b/src/MsBullet.Sdk.IntegrationTests/testassets/MultipleProjectsWithTests/src/ClassLib2.Tests/ClassLib2.Tests.csproj
index 4f737d3..a501846 100644
--- a/src/MsBullet.Sdk.IntegrationTests/testassets/MultipleProjectsWithTests/src/ClassLib2.Tests/ClassLib2.Tests.csproj
+++ b/src/MsBullet.Sdk.IntegrationTests/testassets/MultipleProjectsWithTests/src/ClassLib2.Tests/ClassLib2.Tests.csproj
@@ -3,7 +3,7 @@
net7.0
- $(NoWarn);SA0001;SA1633;SA1200
+ $(NoWarn);SA0001;SA1633;SA1200;SA1600
diff --git a/src/MsBullet.Sdk.IntegrationTests/testassets/MultipleProjectsWithTests/src/ClassLib2/ClassLib2.csproj b/src/MsBullet.Sdk.IntegrationTests/testassets/MultipleProjectsWithTests/src/ClassLib2/ClassLib2.csproj
index 3b4a957..cc51340 100644
--- a/src/MsBullet.Sdk.IntegrationTests/testassets/MultipleProjectsWithTests/src/ClassLib2/ClassLib2.csproj
+++ b/src/MsBullet.Sdk.IntegrationTests/testassets/MultipleProjectsWithTests/src/ClassLib2/ClassLib2.csproj
@@ -5,7 +5,7 @@
true
- $(NoWarn);CA1822;SA0001;SA1633;SA1200;S3400
+ $(NoWarn);CA1822;SA0001;SA1633;SA1200;SA1600;S3400
diff --git a/src/MsBullet.Sdk.Tests/CodingStyleAndConsistencyToolsTests.cs b/src/MsBullet.Sdk.Tests/CodingStyleAndConsistencyToolsTests.cs
index 273f142..ebfbace 100644
--- a/src/MsBullet.Sdk.Tests/CodingStyleAndConsistencyToolsTests.cs
+++ b/src/MsBullet.Sdk.Tests/CodingStyleAndConsistencyToolsTests.cs
@@ -2,12 +2,9 @@
using System;
using System.Collections.Generic;
-using System.Linq;
using FluentAssertions;
using FluentAssertions.Execution;
-using Microsoft.Build.Construction;
using Microsoft.Build.Evaluation;
-using Microsoft.CodeAnalysis;
using Xunit;
using Xunit.Abstractions;
@@ -72,7 +69,7 @@ public void ShouldBeIncludeStyleCopConfigIntoProjectRoot()
var andWitchConstraint = project
.ShouldContainItem("AdditionalFiles")
.Should()
- .ContainSingle(i => i.EvaluatedInclude.Equals(project.ShouldCountainProperty("StyleCopConfig", string.Empty).EvaluatedValue));
+ .ContainSingle(i => i.EvaluatedInclude.Equals(project.ShouldCountainProperty("StyleCopConfig", string.Empty).EvaluatedValue, StringComparison.OrdinalIgnoreCase));
andWitchConstraint
.Which
@@ -90,7 +87,7 @@ public void ShouldBeIncludeStyleCopConfigIntoProjectRoot()
.Which
.DirectMetadata
.Should()
- .ContainSingle(c => c.Name.Equals("Visible"))
+ .ContainSingle(c => c.Name.Equals("Visible", StringComparison.OrdinalIgnoreCase))
.Which
.UnevaluatedValue
.Should()
@@ -109,7 +106,7 @@ public void ShouldNotIncludeStyleCopConfigIntoProjectRootWhenItIsOptedOut()
project
.ShouldContainItem("AdditionalFiles")
.Should()
- .NotContain(i => i.EvaluatedInclude.Equals(project.ShouldCountainProperty("StyleCopConfig", string.Empty).EvaluatedValue));
+ .NotContain(i => i.EvaluatedInclude.Equals(project.ShouldCountainProperty("StyleCopConfig", string.Empty).EvaluatedValue, StringComparison.OrdinalIgnoreCase));
}
[Fact(DisplayName = "Should be referenced StyleCopAnalyzers package")]
diff --git a/src/MsBullet.Sdk.Tests/ProjectDefaultsTests.cs b/src/MsBullet.Sdk.Tests/ProjectDefaultsTests.cs
index 209bc0f..9d73e4d 100644
--- a/src/MsBullet.Sdk.Tests/ProjectDefaultsTests.cs
+++ b/src/MsBullet.Sdk.Tests/ProjectDefaultsTests.cs
@@ -118,14 +118,14 @@ public ProjectDefaultsTests(ITestOutputHelper output, TestProjectFixture fixture
new string[] { "uap10.0" }
};
- public IEnumerable FrameworkDependentPackages => new string[]
+ public static IEnumerable FrameworkDependentPackages => new string[]
{
"Microsoft.NETCore.App",
"NETStandard.Library"
};
- [Fact(DisplayName = "Should has a valorized engeenering directory name")]
- public virtual void ShouldHasAValorizedEngeeneringDirectoryName()
+ [Fact(DisplayName = "Should has a valorized engineering directory name")]
+ public virtual void ShouldHasAValorizedEngineeringDirectoryName()
{
var project = this.ProvideProject();
@@ -165,7 +165,7 @@ public void ShouldHaveOnlyPackagesReferenceWithPrivateAssets(string targetFramew
{ "TargetFramework", targetFramework }
});
- var excludePackages = this.FrameworkDependentPackages;
+ var excludePackages = FrameworkDependentPackages;
#pragma warning disable S1135 // Track uses of "TODO" tags
/*
@@ -173,10 +173,10 @@ public void ShouldHaveOnlyPackagesReferenceWithPrivateAssets(string targetFramew
* Investigate why it is added even though the IsTestProject property is false.
*
* Todo: System.Runtime.InteropServices.NFloat.Internal
- * This package reference is shipped whitin a iOS and macOS runtimes.
+ * This package reference is shipped whit in a iOS and macOS runtimes.
*/
#pragma warning restore S1135 // Track uses of "TODO" tags
- bool.TryParse(project.GetPropertyValue("IsTestProject"), out var isTestProject);
+ _ = bool.TryParse(project.GetPropertyValue("IsTestProject"), out var isTestProject);
if (!isTestProject)
{
excludePackages = excludePackages.Append("Microsoft.NET.Test.Sdk");
@@ -218,11 +218,11 @@ public virtual void ShouldBeReferenceRoslynAnalyzer(string targetFramework)
.Contain(i => ensureInclude(i, "Microsoft.CodeAnalysis.NetAnalyzers"));
}
- [Theory(DisplayName = "Should enforching all analysis rules")]
+ [Theory(DisplayName = "Should enforcing all analysis rules")]
[MemberData(nameof(AllNet5TargetFrameworks))]
[MemberData(nameof(AllNet6TargetFrameworks))]
[MemberData(nameof(AllNet7TargetFrameworks))]
- public virtual void ShouldEnforchingAllAnalysisRules(string targetFramework)
+ public virtual void ShouldEnforcingAllAnalysisRules(string targetFramework)
{
if (this.IsAKnownBrokenCrossTarget(targetFramework))
{
@@ -247,12 +247,12 @@ public virtual void ShouldEnforchingAllAnalysisRules(string targetFramework)
.ShouldEvaluatedEquivalentTo(true);
}
- [Fact(DisplayName = "Should respect user package reference verions")]
+ [Fact(DisplayName = "Should respect user package reference versions")]
public virtual void ShouldRespectUserPackageReferenceVersions()
{
var project = this.ProvideProject();
- var excludePackages = this.FrameworkDependentPackages;
+ var excludePackages = FrameworkDependentPackages;
#pragma warning disable S1135 // Track uses of "TODO" tags
/*
@@ -260,7 +260,7 @@ public virtual void ShouldRespectUserPackageReferenceVersions()
* Investigate why it is added even though the IsTestProject property is false.
*/
#pragma warning restore S1135 // Track uses of "TODO" tags
- bool.TryParse(project.GetPropertyValue("IsTestProject"), out var isTestProject);
+ _ = bool.TryParse(project.GetPropertyValue("IsTestProject"), out var isTestProject);
if (!isTestProject)
{
excludePackages = excludePackages.Append("Microsoft.NET.Test.Sdk");
diff --git a/src/MsBullet.Sdk.Tests/ReportCoverageToolsTests.cs b/src/MsBullet.Sdk.Tests/ReportCoverageToolsTests.cs
index 092df97..644b006 100644
--- a/src/MsBullet.Sdk.Tests/ReportCoverageToolsTests.cs
+++ b/src/MsBullet.Sdk.Tests/ReportCoverageToolsTests.cs
@@ -3,6 +3,7 @@
using System;
using System.Collections.Generic;
using FluentAssertions;
+using FluentAssertions.Execution;
using Microsoft.Build.Evaluation;
using Xunit;
using Xunit.Abstractions;
@@ -111,11 +112,26 @@ public void ShouldBeRespectTheVersionSetup()
.Which
.DirectMetadata
.Should()
- .ContainSingle(m => m.Name.Equals("Version"))
+ .ContainSingle(m => m.Name.Equals("Version", StringComparison.OrdinalIgnoreCase))
.Which
.UnevaluatedValue
.Should()
.Be("$(ReportGeneratorVersion)");
}
+
+ [Theory(DisplayName = "Should not be define report generation target when it is opted out")]
+ [InlineData("ReportCoverage")]
+ [InlineData("ReportCoverageSummary")]
+ public void ShouldNotBeDefineTargetWhenItIsOptedOut(string target)
+ {
+ var project = this.fixture.ProvideUnitTestProject(this.output, new Dictionary() { { "UsingToolReportGenerator", "false" } });
+
+ project
+ .ShouldCountainSingleTarget(target)
+ .Value
+ .Condition
+ .Should()
+ .Contain("'$(UsingToolReportGenerator)' == 'true'");
+ }
}
}
diff --git a/src/MsBullet.Sdk.Tests/TestsProjectDefaultTests.cs b/src/MsBullet.Sdk.Tests/TestsProjectDefaultTests.cs
index 5e183ef..ed11b8d 100644
--- a/src/MsBullet.Sdk.Tests/TestsProjectDefaultTests.cs
+++ b/src/MsBullet.Sdk.Tests/TestsProjectDefaultTests.cs
@@ -47,7 +47,8 @@ public void ShouldOnlyHaveReferencePackagesWithTheHighestAcceptableStableVersion
{
var items = project.ShouldContainItem("PackageReference");
- foreach (var item in items.ExceptBy(expectedPackageVersions.Select(p => p.Key).Concat(this.FrameworkDependentPackages), i => i.EvaluatedInclude))
+#pragma warning disable CA1851 // Possible multiple enumerations of 'IEnumerable' collection
+ foreach (var item in items.ExceptBy(expectedPackageVersions.Select(p => p.Key).Concat(FrameworkDependentPackages), i => i.EvaluatedInclude))
{
item.ShouldContainMetadata("Version").EvaluatedValue
.Should()
@@ -60,6 +61,7 @@ public void ShouldOnlyHaveReferencePackagesWithTheHighestAcceptableStableVersion
.Should()
.Be(expectedPackageVersions[item.EvaluatedInclude]);
}
+#pragma warning restore CA1851 // Possible multiple enumerations of 'IEnumerable' collection
}
}
diff --git a/src/MsBullet.Sdk.Tests/Utilities/ProjectAssertionsExtensions.cs b/src/MsBullet.Sdk.Tests/Utilities/ProjectAssertionsExtensions.cs
index c39fdd6..00f80c2 100644
--- a/src/MsBullet.Sdk.Tests/Utilities/ProjectAssertionsExtensions.cs
+++ b/src/MsBullet.Sdk.Tests/Utilities/ProjectAssertionsExtensions.cs
@@ -1,9 +1,7 @@
// See the LICENSE.TXT file in the project root for full license information.
-using System;
using System.Collections.Generic;
using FluentAssertions;
-using FluentAssertions.Collections;
namespace Microsoft.Build.Evaluation
{
diff --git a/src/MsBullet.Sdk.Tests/Utilities/ProjectPropertyAssertionsExtensions.cs b/src/MsBullet.Sdk.Tests/Utilities/ProjectPropertyAssertionsExtensions.cs
index a56e0df..e8794d2 100644
--- a/src/MsBullet.Sdk.Tests/Utilities/ProjectPropertyAssertionsExtensions.cs
+++ b/src/MsBullet.Sdk.Tests/Utilities/ProjectPropertyAssertionsExtensions.cs
@@ -1,9 +1,7 @@
// See the LICENSE.TXT file in the project root for full license information.
using System;
-using System.Collections.Generic;
using System.Globalization;
-using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using FluentAssertions;
diff --git a/src/MsBullet.Sdk.Tests/Utilities/ProjectTargetAssertionsExtensions.cs b/src/MsBullet.Sdk.Tests/Utilities/ProjectTargetAssertionsExtensions.cs
new file mode 100644
index 0000000..59c3676
--- /dev/null
+++ b/src/MsBullet.Sdk.Tests/Utilities/ProjectTargetAssertionsExtensions.cs
@@ -0,0 +1,20 @@
+// See the LICENSE.TXT file in the project root for full license information.
+
+using System;
+using System.Collections.Generic;
+using FluentAssertions;
+using Microsoft.Build.Execution;
+
+namespace Microsoft.Build.Evaluation
+{
+ internal static class ProjectTargetAssertionsExtensions
+ {
+ public static KeyValuePair ShouldCountainSingleTarget(this Project project, string name, string because = "", params object[] becauseArgs)
+ {
+ return project.Targets
+ .Should()
+ .ContainSingle(i => i.Key.Equals(name, StringComparison.OrdinalIgnoreCase), because, becauseArgs)
+ .Subject;
+ }
+ }
+}
diff --git a/src/MsBullet.Sdk.Tests/Utilities/TestProjectFixture.cs b/src/MsBullet.Sdk.Tests/Utilities/TestProjectFixture.cs
index f3289df..46e5319 100644
--- a/src/MsBullet.Sdk.Tests/Utilities/TestProjectFixture.cs
+++ b/src/MsBullet.Sdk.Tests/Utilities/TestProjectFixture.cs
@@ -95,7 +95,7 @@ protected virtual void Dispose(bool disposing)
{
if (disposing)
{
- while (this.disposables.Count > 0)
+ while (!this.disposables.IsEmpty)
{
if (this.disposables.TryDequeue(out IDisposable disposable))
{
diff --git a/src/MsBullet.Sdk.Tests/Utilities/XUnitLogger.cs b/src/MsBullet.Sdk.Tests/Utilities/XUnitLogger.cs
index 4750dc8..e587a96 100644
--- a/src/MsBullet.Sdk.Tests/Utilities/XUnitLogger.cs
+++ b/src/MsBullet.Sdk.Tests/Utilities/XUnitLogger.cs
@@ -6,7 +6,7 @@
namespace MsBullet.Sdk.Tests
{
- internal class XUnitLogger : ConsoleLogger
+ internal sealed class XUnitLogger : ConsoleLogger
{
public XUnitLogger(ITestOutputHelper output)
: this(output, LoggerVerbosity.Normal)
diff --git a/src/MsBullet.Sdk/tools/CollectCoverage.targets b/src/MsBullet.Sdk/tools/CollectCoverage.targets
index 06712cf..6772055 100644
--- a/src/MsBullet.Sdk/tools/CollectCoverage.targets
+++ b/src/MsBullet.Sdk/tools/CollectCoverage.targets
@@ -1,7 +1,7 @@
-
+
<_GetCollectCoverageCallbackTarget Condition="'$(CollectCoverageToolName)' == 'Coverlet'">GenerateCoverageResultAfterTest
diff --git a/src/MsBullet.Sdk/tools/ReportCoverage.targets b/src/MsBullet.Sdk/tools/ReportCoverage.targets
index 24e4405..f206eb2 100644
--- a/src/MsBullet.Sdk/tools/ReportCoverage.targets
+++ b/src/MsBullet.Sdk/tools/ReportCoverage.targets
@@ -1,8 +1,8 @@
-
-
+
+
diff --git a/version.json b/version.json
index 8512d3e..ae4dfb8 100644
--- a/version.json
+++ b/version.json
@@ -1,6 +1,6 @@
{
"$schema": "https://raw.githubusercontent.com/AArnott/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json",
- "version": "0.6.5",
+ "version": "0.6.6",
"publicReleaseRefSpec": [
"^refs/tags/\\d+\\.\\d+"
],