diff --git a/Directory.Build.props b/Directory.Build.props index 7365dbf02..14f67a964 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -7,6 +7,7 @@ embedded true true + true @@ -53,15 +54,14 @@ - + - - + - + diff --git a/Directory.Packages.props b/Directory.Packages.props index 5a1a8e0e3..cac8ad824 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -4,22 +4,22 @@ true - - - - - + + + + + - - + + - + @@ -28,22 +28,21 @@ - - + + - + - - + + - - - + + - + @@ -64,15 +63,15 @@ - + - - - - + + + + diff --git a/build/_build.csproj b/build/_build.csproj index cee68e3d4..612df9772 100644 --- a/build/_build.csproj +++ b/build/_build.csproj @@ -54,7 +54,7 @@ - + diff --git a/global.json b/global.json index 1e7fdfa95..5bb49fea7 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,9 @@ { - "sdk": { - "version": "10.0.100", - "rollForward": "latestMinor" - } + "sdk": { + "version": "10.0.100", + "rollForward": "latestMinor" + }, + "test": { + "runner": "Microsoft.Testing.Platform" + } } diff --git a/src/Fallout.Build/Telemetry/Telemetry.cs b/src/Fallout.Build/Telemetry/Telemetry.cs index 0f7878410..053f81f66 100644 --- a/src/Fallout.Build/Telemetry/Telemetry.cs +++ b/src/Fallout.Build/Telemetry/Telemetry.cs @@ -27,8 +27,6 @@ internal static partial class Telemetry private const string VersionPropertyName = "FalloutTelemetryVersion"; private const string LegacyVersionPropertyName = "NukeTelemetryVersion"; - private static readonly int? s_confirmedVersion; - static Telemetry() { var optoutParameter = ParameterService.GetParameter(OptOutEnvironmentKey) @@ -123,4 +121,4 @@ private static void WaitForEnter() response = Console.ReadKey(intercept: true).Key; } while (response != ConsoleKey.Enter); } -} \ No newline at end of file +} diff --git a/src/Fallout.Cli/Commands/IFalloutCommand.cs b/src/Fallout.Cli/Commands/IFalloutCommand.cs index f583aa87d..b85932af3 100644 --- a/src/Fallout.Cli/Commands/IFalloutCommand.cs +++ b/src/Fallout.Cli/Commands/IFalloutCommand.cs @@ -19,6 +19,7 @@ internal interface IFalloutCommand /// The command name as typed after the : prefix (prefer dash form, e.g. "add-package").\ /// Matched case-insensitively and with dashes ignored (so :addpackage also matches).\ /// Legacy commands may still use PascalCase names (e.g. "GetNextDirectory"). + /// string Name { get; } /// diff --git a/src/Fallout.Components/ITest.cs b/src/Fallout.Components/ITest.cs index 537beb206..dda1cd84f 100644 --- a/src/Fallout.Components/ITest.cs +++ b/src/Fallout.Components/ITest.cs @@ -94,15 +94,15 @@ IEnumerable GetOutcomes(AbsolutePath file) sealed Configure TestProjectSettingsBase => (_, v) => _ .SetProjectFile(v) - // https://github.com/Tyrrrz/GitHubActionsTestLogger - .When(GitHubActions.Instance is not null && v.HasPackageReference("GitHubActionsTestLogger"), _ => _ - .AddLoggers("GitHubActions;report-warnings=false")) - // https://github.com/JetBrains/TeamCity.VSTest.TestAdapter - .When(TeamCity.Instance is not null && v.HasPackageReference("TeamCity.VSTest.TestAdapter"), _ => _ - .AddLoggers("TeamCity") - // https://github.com/xunit/visualstudio.xunit/pull/108 - .AddRunSetting("RunConfiguration.NoAutoReporters", bool.TrueString)) - .AddLoggers($"trx;LogFileName={v.Name}.trx") + // // https://github.com/Tyrrrz/GitHubActionsTestLogger + // .When(GitHubActions.Instance is not null && v.HasPackageReference("GitHubActionsTestLogger"), _ => _ + // .AddLoggers("GitHubActions;report-warnings=false")) + // // https://github.com/JetBrains/TeamCity.VSTest.TestAdapter + // .When(TeamCity.Instance is not null && v.HasPackageReference("TeamCity.VSTest.TestAdapter"), _ => _ + // .AddLoggers("TeamCity") + // // https://github.com/xunit/visualstudio.xunit/pull/108 + // .AddRunSetting("RunConfiguration.NoAutoReporters", bool.TrueString)) + // .AddLoggers($"trx;LogFileName={v.Name}.trx") .When(InvokedTargets.Contains((this as IReportCoverage)?.ReportCoverage) || IsServerBuild, _ => _ .SetCoverletOutput(TestResultDirectory / $"{v.Name}.xml")); diff --git a/src/Fallout.MSBuildTasks/CodeGenerationTask.cs b/src/Fallout.MSBuildTasks/CodeGenerationTask.cs index 042b73cda..cdc92bb95 100644 --- a/src/Fallout.MSBuildTasks/CodeGenerationTask.cs +++ b/src/Fallout.MSBuildTasks/CodeGenerationTask.cs @@ -1,10 +1,9 @@ -using System; using System.Linq; using Microsoft.Build.Framework; using Fallout.CodeGeneration; using Fallout.CodeGeneration.Model; -using Fallout.Common.IO; using Fallout.Common.Utilities.Collections; +using AbsolutePath = Fallout.Common.IO.AbsolutePath; namespace Fallout.MSBuildTasks; diff --git a/src/Fallout.SourceGenerators/Fallout.SourceGenerators.csproj b/src/Fallout.SourceGenerators/Fallout.SourceGenerators.csproj index 4bb79c6b1..d6dcf39da 100644 --- a/src/Fallout.SourceGenerators/Fallout.SourceGenerators.csproj +++ b/src/Fallout.SourceGenerators/Fallout.SourceGenerators.csproj @@ -25,11 +25,13 @@ + + @@ -39,13 +41,14 @@ - - - - + + + + - + + diff --git a/src/Persistence/Fallout.Persistence.Solution/Shims.cs b/src/Persistence/Fallout.Persistence.Solution/Shims.cs index ad41e9a31..9e7be05e7 100644 --- a/src/Persistence/Fallout.Persistence.Solution/Shims.cs +++ b/src/Persistence/Fallout.Persistence.Solution/Shims.cs @@ -21,7 +21,7 @@ public static bool Contains(this string str, char c) return str.Contains(c.ToString()); } - public static bool TryGetValue(this HashSet set, T equalValue, out T actualValue) + public static bool TryGetValue(this HashSet set, T equalValue, out T? actualValue) { foreach (var item in set) { diff --git a/tests/Fallout.Common.Specs/CISpecs.cs b/tests/Fallout.Common.Specs/CISpecs.cs index 81d76213e..1bd358317 100644 --- a/tests/Fallout.Common.Specs/CISpecs.cs +++ b/tests/Fallout.Common.Specs/CISpecs.cs @@ -116,8 +116,8 @@ private static object CreateInstance(Type type) private static bool IsRunning(Type type) { - var property = type.GetProperty($"IsRunning{type.Name}", BindingFlags.NonPublic | BindingFlags.Static).NotNull(); - return (bool) property.GetValue(obj: null); + var property = type?.GetProperty($"IsRunning{type.Name}", BindingFlags.NonPublic | BindingFlags.Static).NotNull(); + return (bool?)property?.GetValue(obj: null) ?? false; } private class CITheoryAttribute : TheoryAttribute @@ -127,8 +127,7 @@ private class CITheoryAttribute : TheoryAttribute public CITheoryAttribute(Type type) { _type = type; + Skip = !IsRunning(_type) ? $"Only applies to {_type.Name}." : null; } - - public override string Skip => !IsRunning(_type) ? $"Only applies to {_type.Name}." : null; } } diff --git a/tests/Fallout.Common.Specs/ChangelogReferenceFiles/changelog_reference_NUKE_variant_1.verified.txt b/tests/Fallout.Common.Specs/ChangelogReferenceFiles/changelog_reference_NUKE_variant_1.verified.txt index c2b49667d..fa4b0d9c6 100644 --- a/tests/Fallout.Common.Specs/ChangelogReferenceFiles/changelog_reference_NUKE_variant_1.verified.txt +++ b/tests/Fallout.Common.Specs/ChangelogReferenceFiles/changelog_reference_NUKE_variant_1.verified.txt @@ -3,7 +3,7 @@ IsEmpty: true, Unreleased: true, Notes: [ - + ], StartIndex: 6, EndIndex: 7 @@ -15,7 +15,7 @@ Notes: [ - Added something, - Fixed something, - + ], StartIndex: 8, EndIndex: 11 @@ -26,7 +26,7 @@ Version: 1.2.2, Notes: [ - Fixed something, - + ], StartIndex: 12, EndIndex: 14 @@ -37,7 +37,7 @@ Version: 0.2.0, Notes: [ - Added something, - + ], StartIndex: 15, EndIndex: 17 @@ -54,4 +54,4 @@ StartIndex: 18, EndIndex: 21 } -] \ No newline at end of file +] diff --git a/tests/Fallout.Common.Specs/ChangelogReferenceFiles/changelog_reference_NUKE_variant_2.verified.txt b/tests/Fallout.Common.Specs/ChangelogReferenceFiles/changelog_reference_NUKE_variant_2.verified.txt index 8e7ed6050..163a6cd4d 100644 --- a/tests/Fallout.Common.Specs/ChangelogReferenceFiles/changelog_reference_NUKE_variant_2.verified.txt +++ b/tests/Fallout.Common.Specs/ChangelogReferenceFiles/changelog_reference_NUKE_variant_2.verified.txt @@ -4,7 +4,7 @@ Unreleased: true, Notes: [ - Changed something, - + ], StartIndex: 6, EndIndex: 8 @@ -15,12 +15,12 @@ Version: 1.0.0, Notes: [ - Some text that spans, - multiple lines, + multiple lines, - A text on a single line, , - Added something, - Fixed something, - + ], StartIndex: 9, EndIndex: 16 @@ -39,4 +39,4 @@ StartIndex: 17, EndIndex: 22 } -] \ No newline at end of file +] diff --git a/tests/Fallout.Core.Specs/ArchitectureFitnessSpecs.cs b/tests/Fallout.Core.Specs/ArchitectureFitnessSpecs.cs index 0c00c7f8f..7857c1167 100644 --- a/tests/Fallout.Core.Specs/ArchitectureFitnessSpecs.cs +++ b/tests/Fallout.Core.Specs/ArchitectureFitnessSpecs.cs @@ -1,9 +1,9 @@ -using System.Linq; using System.Reflection; using FluentAssertions; using Fallout.Core.Planning; using NetArchTest.Rules; using Xunit; +using TestResult = NetArchTest.Rules.TestResult; namespace Fallout.Core.Specs; diff --git a/tests/Fallout.ProjectModel.Specs/ProjectModelSpecs.cs b/tests/Fallout.ProjectModel.Specs/ProjectModelSpecs.cs index 37c2b26e0..84d8bb162 100644 --- a/tests/Fallout.ProjectModel.Specs/ProjectModelSpecs.cs +++ b/tests/Fallout.ProjectModel.Specs/ProjectModelSpecs.cs @@ -25,7 +25,7 @@ public void ProjectSpec() project.GetTargetFrameworks().Should().Equal("net8.0", "net9.0", "net10.0"); project.HasPackageReference("Microsoft.Build.Locator").Should().BeTrue(); project.GetPackageReferenceVersion("Microsoft.Build.Locator").Should().Be("1.7.8"); - project.GetPackageReferenceVersion("Microsoft.Build").Should().Be("18.0.2"); + project.GetPackageReferenceVersion("Microsoft.Build").Should().Be("18.7.1"); } [Fact] diff --git a/tests/Fallout.Utilities.Specs/IO/CompressionTasksSpecs.cs b/tests/Fallout.Utilities.Specs/IO/CompressionTasksSpecs.cs index 7e8fd9271..53c98ed74 100644 --- a/tests/Fallout.Utilities.Specs/IO/CompressionTasksSpecs.cs +++ b/tests/Fallout.Utilities.Specs/IO/CompressionTasksSpecs.cs @@ -4,7 +4,6 @@ using FluentAssertions; using Fallout.Common.IO; using Xunit; -using Xunit.Abstractions; namespace Fallout.Common.Specs; diff --git a/tests/Fallout.Utilities.Specs/IO/FileSystemDependentSpecs.cs b/tests/Fallout.Utilities.Specs/IO/FileSystemDependentSpecs.cs index 0de1336c0..053de65d3 100644 --- a/tests/Fallout.Utilities.Specs/IO/FileSystemDependentSpecs.cs +++ b/tests/Fallout.Utilities.Specs/IO/FileSystemDependentSpecs.cs @@ -2,9 +2,11 @@ using System.IO; using System.Linq; using System.Reflection; +using System.Text.RegularExpressions; using Fallout.Common; using Fallout.Common.IO; -using Xunit.Abstractions; +using Xunit; +using Xunit.Sdk; namespace Fallout.Common.Specs; @@ -21,9 +23,11 @@ protected FileSystemDependentSpecs(ITestOutputHelper testOutputHelper) { TestOutputHelper = testOutputHelper; - TestName = ((ITest) testOutputHelper.GetType() - .GetField("test", BindingFlags.NonPublic | BindingFlags.Instance).NotNull() - .GetValue(testOutputHelper).NotNull()).TestCase.TestMethod.Method.Name; + TestName = TestContext.Current.Test?.TestDisplayName ?? ""; + TestName = Regex.Replace(TestName, @"[<>:""/\\|?*\x00-\x1F]", "_").Trim().TrimEnd('.', ' '); + TestName = Regex.IsMatch(TestName, "^(CON|PRN|AUX|NUL|COM[1-9]|LPT[1-9])$", RegexOptions.IgnoreCase) + ? $"_{TestName}" + : TestName; ExecutionDirectory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location).NotNull(); RootDirectory = Constants.TryGetRootDirectoryFrom(EnvironmentInfo.WorkingDirectory); diff --git a/tests/Fallout.Utilities.Specs/IO/MoveCopySpecs.cs b/tests/Fallout.Utilities.Specs/IO/MoveCopySpecs.cs index 37729a381..f75c87108 100644 --- a/tests/Fallout.Utilities.Specs/IO/MoveCopySpecs.cs +++ b/tests/Fallout.Utilities.Specs/IO/MoveCopySpecs.cs @@ -4,7 +4,6 @@ using Fallout.Common.IO; using Fallout.Common.Utilities.Collections; using Xunit; -using Xunit.Abstractions; namespace Fallout.Common.Specs;