diff --git a/.fallout/build.schema.json b/.fallout/build.schema.json index 8274ca869..fde15dc2b 100644 --- a/.fallout/build.schema.json +++ b/.fallout/build.schema.json @@ -148,6 +148,16 @@ "type": "string", "default": "Secrets must be entered via 'fallout :secrets [profile]'" }, + "NuGetSource": { + "type": "string" + }, + "PublishTo": { + "type": "array", + "description": "Publish only to these named targets (default: all configured PublishTargets)", + "items": { + "type": "string" + } + }, "Solution": { "type": "string", "description": "Path to a solution file that is automatically loaded" diff --git a/AssemblyInfo.cs b/AssemblyInfo.cs index c5e26e6d6..c7362d976 100644 --- a/AssemblyInfo.cs +++ b/AssemblyInfo.cs @@ -2,21 +2,22 @@ [assembly: InternalsVisibleTo("Fallout.Build")] [assembly: InternalsVisibleTo("Fallout.Build.Shared")] -[assembly: InternalsVisibleTo("Fallout.Build.Tests")] +[assembly: InternalsVisibleTo("Fallout.Build.Specs")] [assembly: InternalsVisibleTo("Fallout.Common")] -[assembly: InternalsVisibleTo("Fallout.Common.Tests")] +[assembly: InternalsVisibleTo("Fallout.Common.Specs")] [assembly: InternalsVisibleTo("Fallout.Cli")] -[assembly: InternalsVisibleTo("Fallout.Cli.Tests")] -[assembly: InternalsVisibleTo("Fallout.ProjectModel.Tests")] +[assembly: InternalsVisibleTo("Fallout.Cli.Specs")] +[assembly: InternalsVisibleTo("Fallout.ProjectModel.Specs")] [assembly: InternalsVisibleTo("Fallout.SourceGenerators")] +[assembly: InternalsVisibleTo("Fallout.Solution.Codegen")] [assembly: InternalsVisibleTo("Fallout.Solution")] -[assembly: InternalsVisibleTo("Fallout.Solution.Tests")] +[assembly: InternalsVisibleTo("Fallout.Solution.Specs")] [assembly: InternalsVisibleTo("Fallout.Persistence.Solution")] [assembly: InternalsVisibleTo("Fallout.Persistence.Solution.Tests")] [assembly: InternalsVisibleTo("Fallout.Tooling")] -[assembly: InternalsVisibleTo("Fallout.Tooling.Tests")] +[assembly: InternalsVisibleTo("Fallout.Tooling.Specs")] [assembly: InternalsVisibleTo("Fallout.Utilities.IO.Globbing")] -[assembly: InternalsVisibleTo("Fallout.Utilities.Tests")] +[assembly: InternalsVisibleTo("Fallout.Utilities.Specs")] // External extensions — kept as Nuke.* until those projects rebrand independently. [assembly: InternalsVisibleTo("Nuke.VisualStudio")] diff --git a/Directory.Build.props b/Directory.Build.props index c47fd492a..7365dbf02 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -22,7 +22,7 @@ README.md - + False @@ -53,7 +53,7 @@ - + diff --git a/build/Build.cs b/build/Build.cs index fc884944a..fdf7dae5b 100644 --- a/build/Build.cs +++ b/build/Build.cs @@ -98,7 +98,7 @@ private static int ParseMajor(string informationalVersion) from framework in project.GetTargetFrameworks() select (project, framework); - IEnumerable ITest.TestProjects => Partition.GetCurrent(Solution.GetAllProjects("*.Tests")); + IEnumerable ITest.TestProjects => Partition.GetCurrent(Solution.GetAllProjects("*.Specs")); [Parameter] public int TestDegreeOfParallelism { get; } = 1; diff --git a/build/_build.csproj b/build/_build.csproj index cee68e3d4..069426f46 100644 --- a/build/_build.csproj +++ b/build/_build.csproj @@ -14,6 +14,14 @@ false + + + Build + $(MSBuildProjectDirectory)\..\src\Fallout.Solution.Codegen\Fallout.Solution.Codegen.csproj + $(MSBuildProjectDirectory)\.. + + False @@ -72,5 +80,6 @@ + diff --git a/docs/agents/conventions.md b/docs/agents/conventions.md index bd74b12ec..4bd698142 100644 --- a/docs/agents/conventions.md +++ b/docs/agents/conventions.md @@ -5,6 +5,8 @@ Three groups: conventions to respect, things never to do, and the tool-wrapper r ## Conventions worth respecting - **Centralized package versions** — add new packages to `Directory.Packages.props`, never inline. Adding a *meaningful* library (not a tiny transitive helper)? Add a row to [docs/dependencies.md](https://github.com/Fallout-build/Fallout/blob/main/docs/dependencies.md) in the same PR — reviewers will ask. +- **Test naming follows AV1600 behavior-focused style.** Write test names as short, present-tense descriptions of observable behavior, not method calls. Example good: `Missing_changelog_does_not_add_a_full_changelog_link_to_release_notes`. Example bad: `GetNuGetReleaseNotes_WithMissingChangelog_AndGitHubRepository_DoesNotThrow`. Focus on "what happens" not "what method is called" (see [AV1600](references/testability.md#AV1620)). +- **Test files and classes use `Specs` suffix.** Name test projects `Foo.Specs`, test files `FooSpecs.cs`, and test classes `FooSpecs`. Use `Specs` not `Test` or `Tests` — it clarifies that the class describes the expected behavior (specification) of the subject under test. - **Tool wrappers**: copy/paste from neighbours; cover full commands; use ``, ``, `
    `/`
      `, ``, `` in `help`; don't write `secret: false` or `default: xxx`. See [Tool wrapper recipe](#tool-wrapper-recipe) below. - **Tests next to code, separate folder**: every `Foo` project under `src/` has a sibling `Foo.Tests` project under `tests/`. Mirror the namespace. - **No IDE-specific style files committed.** `.editorconfig` and `*.DotSettings` were removed during the takeover — relying on `dotnet format` defaults and review. diff --git a/docs/agents/issue-and-pr-style.md b/docs/agents/issue-and-pr-style.md index 35af054f5..cced61e26 100644 --- a/docs/agents/issue-and-pr-style.md +++ b/docs/agents/issue-and-pr-style.md @@ -75,6 +75,7 @@ Closes # in a series). Summarize the need in a line — don't recite the issue's Problem/Outcome/criteria back; the reader can click through. The PR explains *the change*; the issue holds *the requirement*. +- **Create PRs as draft by default.** Use `gh pr create --draft` unless the user explicitly asks for a ready-for-review PR. Convert to ready only when the user explicitly requests it. This keeps incomplete work from accidentally entering review and ensures work stays flexible during early development. - Add the `⚠️ Breaking change` callout **only** when the change is breaking — see the [PR-creation flow](release-and-versioning.md#pr-creation-flow) for what that requires. diff --git a/docs/dependencies.md b/docs/dependencies.md index 6e8cbcbba..e88890001 100644 --- a/docs/dependencies.md +++ b/docs/dependencies.md @@ -90,13 +90,17 @@ Still on Matt's personal NuGet account; supply-chain SPOF, high-priority to repl |---|---| | `xunit` (+ `runner.visualstudio`) | Test framework | | `Microsoft.NET.Test.Sdk` | Test host wiring | -| `FluentAssertions` | Readable assertion DSL | +| `FluentAssertions` | Readable assertion DSL — see [licensing note](#fluentassertions-licensing) below | | `Verify.Xunit` (+ `.DiffPlex`, `.SourceGenerators`) | Snapshot-based testing (the `*.verified.txt` / `*.received.txt` pattern) | | `coverlet.msbuild` | Code coverage | | `GitHubActionsTestLogger` | Format test output for GitHub Actions annotations | | `Basic.Reference.Assemblies.NetStandard20` | Reference assemblies for source-generator compile tests | | `NetArchTest.Rules` | Architecture-fitness tests (e.g. `Fallout.Core` purity); broader suite tracked in #95 | +### FluentAssertions licensing + +As of **v8.0** (Jan 2025) FluentAssertions dropped Apache 2.0 for the proprietary **Xceed Community License**: free for open-source / non-commercial use, paid (per-seat) for commercial use. v7.x remains Apache 2.0. We pin **8.x** (`Directory.Packages.props`) and stay current — this is fine for Fallout because it's (a) an OSS project covered by the free community license, and (b) a **test-only / dev-time** dependency that is never redistributed to consumers of the framework. The standard assertion convention (xUnit + FluentAssertions + Verify) is unchanged — see [conventions.md](agents/conventions.md). + ## Build-time CLI tools (`PackageDownload`) These are downloaded by `build/_build.csproj` for use during this repo's own build — not shipped to consumers. diff --git a/fallout.slnx b/fallout.slnx index 59d5c32e7..79fada201 100644 --- a/fallout.slnx +++ b/fallout.slnx @@ -27,6 +27,7 @@ + @@ -35,22 +36,22 @@ - - - - - - - - - - - - + + + + + + + + + + + + - - + + diff --git a/src/Fallout.Build/Host.Activation.cs b/src/Fallout.Build/Host.Activation.cs index 8d611ed92..42dc98f58 100644 --- a/src/Fallout.Build/Host.Activation.cs +++ b/src/Fallout.Build/Host.Activation.cs @@ -29,9 +29,15 @@ internal static IEnumerable AvailableTypes private static bool IsRunning(Type hostType) { var propertyName = $"IsRunning{hostType.Name}"; - var member = hostType.GetProperty(propertyName, ReflectionUtility.Static) - .NotNull($"Host type '{hostType.Name}' defines no property '{propertyName}'"); - return member.GetValue(); + var member = hostType.GetProperty(propertyName, ReflectionUtility.Static); + + // A public Host subclass that doesn't follow the `IsRunning{Name}` convention is + // not a runnable host — treat it as not-running rather than throwing. Host + // auto-detection runs in FalloutBuild's static ctor, so an exception here crashes + // every build that merely references such an assembly. The Nuke.* transition shim + // emits exactly such a subclass (`Nuke.Common.Host`), which made any shim-referencing + // build abort on startup. See Fallout.Canary#3. + return member is not null && member.GetValue(); } private static Host CreateHost(Type hostType) diff --git a/src/Fallout.Common/CI/GitHubActions/Configuration/GitHubActionsJob.cs b/src/Fallout.Common/CI/GitHubActions/Configuration/GitHubActionsJob.cs index ab19c6ad4..40969f717 100644 --- a/src/Fallout.Common/CI/GitHubActions/Configuration/GitHubActionsJob.cs +++ b/src/Fallout.Common/CI/GitHubActions/Configuration/GitHubActionsJob.cs @@ -10,6 +10,7 @@ public class GitHubActionsJob : ConfigurationEntity { public string Name { get; set; } public GitHubActionsImage Image { get; set; } + public string[] RunsOnLabels { get; set; } = new string[0]; public int TimeoutMinutes { get; set; } public string ConcurrencyGroup { get; set; } public string EnvironmentName { get; set; } @@ -24,7 +25,14 @@ public override void Write(CustomFileWriter writer) using (writer.Indent()) { writer.WriteLine($"name: {Name}"); - writer.WriteLine($"runs-on: {Image.GetValue()}"); + if (RunsOnLabels.Length > 0) + { + writer.WriteLine($"runs-on: [{RunsOnLabels.JoinCommaSpace()}]"); + } + else + { + writer.WriteLine($"runs-on: {Image.GetValue()}"); + } if (TimeoutMinutes > 0) { diff --git a/src/Fallout.Common/CI/GitHubActions/GitHubActionsAttribute.cs b/src/Fallout.Common/CI/GitHubActions/GitHubActionsAttribute.cs index 262a7b9b7..54bf1f241 100644 --- a/src/Fallout.Common/CI/GitHubActions/GitHubActionsAttribute.cs +++ b/src/Fallout.Common/CI/GitHubActions/GitHubActionsAttribute.cs @@ -93,6 +93,16 @@ public GitHubActionsAttribute( public string[] InvokedTargets { get; set; } = new string[0]; + /// + /// Runner labels emitted verbatim as runs-on: [label1, label2, ...], for selecting a + /// self-hosted runner pool by OS/arch/capability (e.g. ["self-hosted", "linux", "x64"]). + /// + /// When non-empty this replaces the runs-on: image for the job and requires exactly one + /// image (no matrix). The constructor-mandated is then ignored + /// for runs-on: and only names the job. + /// + public string[] RunsOnLabels { get; set; } = new string[0]; + public GitHubActionsSubmodules Submodules { set => _submodules = value; @@ -176,6 +186,10 @@ public override ConfigurationEntity GetConfiguration(IReadOnlyCollection 0 || configuration.DetailedTriggers.Length > 0, $"Workflows must define either shorthand '{nameof(On)}' or '{nameof(On)}*' triggers"); + Assert.True(RunsOnLabels.Length == 0 || _images.Length == 1, + $"Cannot use '{nameof(RunsOnLabels)}' with multiple images; labels resolve a single job's runner"); + Assert.True(RunsOnLabels.All(x => !x.IsNullOrWhiteSpace()), + $"'{nameof(RunsOnLabels)}' entries must not be null, empty, or whitespace"); return configuration; } @@ -185,6 +199,7 @@ protected virtual GitHubActionsJob GetJobs(GitHubActionsImage image, IReadOnlyCo return new GitHubActionsJob { Name = image.GetValue().Replace(".", "_"), + RunsOnLabels = RunsOnLabels, EnvironmentName = EnvironmentName, EnvironmentUrl = EnvironmentUrl, Steps = GetSteps(relevantTargets).ToArray(), diff --git a/src/Fallout.Common/ChangeLog/ChangeLogTasks.cs b/src/Fallout.Common/ChangeLog/ChangeLogTasks.cs index 2d5d0f307..c354b0293 100644 --- a/src/Fallout.Common/ChangeLog/ChangeLogTasks.cs +++ b/src/Fallout.Common/ChangeLog/ChangeLogTasks.cs @@ -21,10 +21,12 @@ public static class ChangelogTasks { public static string GetNuGetReleaseNotes(string changelogFile, GitRepository repository = null) { + AbsolutePath changelogPath = changelogFile; + // URL-encode characters MSBuild treats as command-line/property metacharacters. // Without this, MSBuild's property parser splits on ; (turning a long release note // into multiple bogus arguments) and chokes on stray " in the value. - var changelogSectionNotes = ExtractChangelogSectionNotes(changelogFile) + var changelogSectionNotes = ExtractChangelogSectionNotes(changelogPath) .Select(x => x.Replace("- ", "\u2022 ") .Replace("* ", "\u2022 ") .Replace("+ ", "\u2022 ") @@ -32,10 +34,10 @@ public static string GetNuGetReleaseNotes(string changelogFile, GitRepository re .Replace(",", "%2C") .Replace(";", "%3B")).ToList(); - if (repository.IsGitHubRepository()) + if (repository.IsGitHubRepository() && changelogPath.FileExists()) { changelogSectionNotes.Add(string.Empty); - changelogSectionNotes.Add($"Full changelog at {repository.GetGitHubBrowseUrl(changelogFile)}"); + changelogSectionNotes.Add($"Full changelog at {repository.GetGitHubBrowseUrl(changelogPath, itemType: GitHubItemType.File)}"); } return changelogSectionNotes.JoinNewLine(); diff --git a/src/Fallout.Migrate/Fallout.Migrate.csproj b/src/Fallout.Migrate/Fallout.Migrate.csproj index 4427b3e44..7018259d3 100644 --- a/src/Fallout.Migrate/Fallout.Migrate.csproj +++ b/src/Fallout.Migrate/Fallout.Migrate.csproj @@ -11,7 +11,7 @@ - + diff --git a/src/Fallout.Solution.Codegen/Fallout.Solution.Codegen.csproj b/src/Fallout.Solution.Codegen/Fallout.Solution.Codegen.csproj new file mode 100644 index 000000000..f54edf0d6 --- /dev/null +++ b/src/Fallout.Solution.Codegen/Fallout.Solution.Codegen.csproj @@ -0,0 +1,26 @@ + + + + Exe + net10.0 + false + Pre-build codegen for the strongly-typed [Solution] accessor (Solution.g.cs). The net10 default that frees the Roslyn generator from the solution-parser dependency cone; reuses the real Fallout.Persistence.Solution parser and the shared SolutionEmitter. + + + + + + + + + + + + + + + + + + + diff --git a/src/Fallout.Solution.Codegen/Program.cs b/src/Fallout.Solution.Codegen/Program.cs new file mode 100644 index 000000000..1fa4580f9 --- /dev/null +++ b/src/Fallout.Solution.Codegen/Program.cs @@ -0,0 +1,109 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text.Json.Nodes; +using Microsoft.CodeAnalysis.CSharp; +using Microsoft.CodeAnalysis.CSharp.Syntax; +using Fallout.Common; +using Fallout.Common.IO; +using Fallout.Common.Utilities; +using Fallout.Solutions; + +// Pre-build codegen for the strongly-typed [Solution] accessor. +// +// Usage: +// Fallout.Solution.Codegen --root --out [--source ...] +// +// Discovers [Solution(GenerateProjects = true)] members by parsing the given source files +// syntactically (no compilation available pre-build), resolves each solution file, and writes +// .g.cs into using the shared SolutionEmitter. No-op (exit 0) if none found. + +var root = GetOption("--root") ?? Directory.GetCurrentDirectory(); +var outDir = GetOption("--out") ?? Path.Combine(root, "obj"); +var sources = GetOptions("--source").Where(File.Exists).ToList(); +if (sources.Count == 0) + sources = Directory.EnumerateFiles(root, "*.cs", SearchOption.AllDirectories).ToList(); + +var rootDirectory = (AbsolutePath)root; +Directory.CreateDirectory(outDir); + +foreach (var (memberName, relativePath, fancyNames) in DiscoverSolutionMembers(sources)) +{ + var solutionFile = !string.IsNullOrEmpty(relativePath) + ? rootDirectory / relativePath + : GetSolutionFileFromParametersFile(rootDirectory, memberName); + + var solution = solutionFile.ReadSolution(); + File.WriteAllText(Path.Combine(outDir, memberName + ".g.cs"), SolutionEmitter.Emit(solution, memberName, fancyNames)); + Console.WriteLine($"Fallout.Solution.Codegen: generated {memberName}.g.cs from {solutionFile}"); +} + +return 0; + +string GetOption(string name) +{ + var index = Array.IndexOf(args, name); + return index >= 0 && index + 1 < args.Length ? args[index + 1] : null; +} + +IEnumerable GetOptions(string name) +{ + for (var i = 0; i < args.Length - 1; i++) + if (args[i] == name) + yield return args[i + 1]; +} + +static IEnumerable<(string MemberName, string RelativePath, bool FancyNames)> DiscoverSolutionMembers(IEnumerable files) +{ + foreach (var file in files) + { + var root = CSharpSyntaxTree.ParseText(File.ReadAllText(file)).GetRoot(); + foreach (var member in root.DescendantNodes().OfType()) + { + if (member is not (FieldDeclarationSyntax or PropertyDeclarationSyntax)) + continue; + + foreach (var attribute in member.AttributeLists.SelectMany(x => x.Attributes)) + { + if (attribute.Name.ToString() is not ("Solution" or "SolutionAttribute")) + continue; + + var arguments = attribute.ArgumentList?.Arguments ?? default; + var generateProjects = arguments.Any(x => + x.NameEquals?.Name.Identifier.Text == "GenerateProjects" && + x.Expression is LiteralExpressionSyntax { Token.Value: true }); + if (!generateProjects) + continue; + + var fancyNames = arguments.Any(x => + x.NameEquals?.Name.Identifier.Text == "FancyNames" && + x.Expression is LiteralExpressionSyntax { Token.Value: true }); + + var relativePath = arguments + .Where(x => x.NameEquals == null && x.NameColon == null) + .Select(x => (x.Expression as LiteralExpressionSyntax)?.Token.Value as string) + .FirstOrDefault(x => !string.IsNullOrEmpty(x)); + + var memberName = member switch + { + FieldDeclarationSyntax field => field.Declaration.Variables.First().Identifier.Text, + PropertyDeclarationSyntax property => property.Identifier.Text, + _ => null, + }; + + if (memberName != null) + yield return (memberName, relativePath, fancyNames); + } + } + } +} + +static AbsolutePath GetSolutionFileFromParametersFile(AbsolutePath rootDirectory, string memberName) +{ + var parametersFile = Constants.GetDefaultParametersFile(rootDirectory); + Assert.FileExists(parametersFile); + var obj = JsonNode.Parse(File.ReadAllText(parametersFile)).NotNull().AsObject(); + var solutionRelativePath = obj[memberName].NotNull($"Property '{memberName}' does not exist in '{parametersFile}'.").GetValue(); + return rootDirectory / solutionRelativePath.NotNull(); +} diff --git a/src/Fallout.Solution.Codegen/build/Fallout.Solution.Codegen.targets b/src/Fallout.Solution.Codegen/build/Fallout.Solution.Codegen.targets new file mode 100644 index 000000000..db80e5574 --- /dev/null +++ b/src/Fallout.Solution.Codegen/build/Fallout.Solution.Codegen.targets @@ -0,0 +1,45 @@ + + + + + + + + + + + + <_FalloutSolutionCodegenOut>$(IntermediateOutputPath)FalloutSolution + <_FalloutSolutionCodegenRoot Condition="'$(FalloutBaseDirectory)' != ''">$(FalloutBaseDirectory) + <_FalloutSolutionCodegenRoot Condition="'$(_FalloutSolutionCodegenRoot)' == ''">$(MSBuildProjectDirectory) + <_FalloutSolutionCodegenInvoke Condition="'$(FalloutSolutionCodegenAssembly)' != ''">dotnet "$(FalloutSolutionCodegenAssembly)" + <_FalloutSolutionCodegenInvoke Condition="'$(_FalloutSolutionCodegenInvoke)' == '' and '$(FalloutSolutionCodegenProject)' != ''">dotnet run -c $(Configuration) --project "$(FalloutSolutionCodegenProject)" -- + + + + + + + + + + + + + diff --git a/src/Fallout.SourceGenerators/Fallout.SourceGenerators.csproj b/src/Fallout.SourceGenerators/Fallout.SourceGenerators.csproj index 4bb79c6b1..0b94b8db1 100644 --- a/src/Fallout.SourceGenerators/Fallout.SourceGenerators.csproj +++ b/src/Fallout.SourceGenerators/Fallout.SourceGenerators.csproj @@ -11,6 +11,11 @@ + + + + + diff --git a/src/Fallout.SourceGenerators/StronglyTypedSolutionGenerator.cs b/src/Fallout.SourceGenerators/StronglyTypedSolutionGenerator.cs index 689f6ef9a..199cdc540 100644 --- a/src/Fallout.SourceGenerators/StronglyTypedSolutionGenerator.cs +++ b/src/Fallout.SourceGenerators/StronglyTypedSolutionGenerator.cs @@ -1,22 +1,21 @@ -using System; -using System.Collections.Generic; +using System; using System.IO; using System.Linq; using System.Text.Json.Nodes; -using System.Text.RegularExpressions; using Microsoft.CodeAnalysis; -using Microsoft.CodeAnalysis.CSharp; -using Microsoft.CodeAnalysis.CSharp.Syntax; using Fallout.Common; using Fallout.Common.IO; using Fallout.Solutions; using Fallout.Common.Utilities; -using Fallout.Common.Utilities.Collections; -using Scriban; -using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory; namespace Fallout.SourceGenerators; +/// +/// In-compiler generator for the strongly-typed [Solution] accessor. This is the +/// toggle fallback (live in-IDE updates); the default is the net10 pre-build +/// Fallout.Solution.Codegen console. Both share , +/// so output is identical. The MSBuild targets suppress this generator when console-mode is active. +/// [Generator] public class StronglyTypedSolutionGenerator : ISourceGenerator { @@ -28,6 +27,12 @@ public void Execute(GeneratorExecutionContext context) { try { + // Toggle: when the net10 pre-build console owns solution codegen, this fallback no-ops + // (so only one path emits Solution.g.cs). Default/unset keeps the generator running. + context.AnalyzerConfigOptions.GlobalOptions.TryGetValue("build_property.FalloutSolutionCodegenMode", out var codegenMode); + if (string.Equals(codegenMode, "Build", StringComparison.OrdinalIgnoreCase)) + return; + var allTypes = context.Compilation.Assembly.GlobalNamespace.GetAllTypes(); var members = allTypes.SelectMany(x => x.GetMembers()) .Where(x => x is IPropertySymbol or IFieldSymbol) @@ -47,93 +52,7 @@ public void Execute(GeneratorExecutionContext context) var fancyNaming = attribute.NamedArguments.SingleOrDefault(x => x.Key == "FancyNames").Value.Value as bool? ?? false; var solution = solutionFile.ReadSolution(); - var hintName = member.Name + ".g.cs"; - var declaration = GetDeclaration(solution); - - // lang=csharp - context.AddSource(hintName, $""" - // - - using Fallout.Persistence.Solution.Model; - using Fallout.Solutions; - using Fallout.Common.IO; - using System.Runtime.CompilerServices; - - {declaration} - """); - - continue; - - string GetDeclaration(IProjectContainer container, string folderName = null) - { - var prefix = new string('_', container.Descendants(x => x.Parent).Count() + 1); - var model = new - { - IsSolution = container is Solution, - SolutionReference = container is Solution ? "this" : "solution", - Name = GetEscapedName(container switch - { - Solution => member.Name, - SolutionFolder folder => folderName ?? folder.Name, - _ => throw new ArgumentOutOfRangeException(nameof(container), container, null) - }), - Projects = container.Projects.OrderBy(x => x.Name).Select(x => new - { - x.Name, - EscapedName = GetEscapedName(x.Name), - }), - Folders = container.SolutionFolders.OrderBy(x => x.Name).Select(x => new - { - x.Name, - TypeName = $"{prefix}{GetEscapedName(x.Name)}", - EscapedName = GetEscapedName(x.Name), - }), - Declarations = container.SolutionFolders.OrderBy(x => x.Name) - .Select(x => GetDeclaration(x, $"{prefix}{GetEscapedName(x.Name)}")).ToArray(), - }; - - // lang=csharp - var template = Template.Parse(""" - {{~ if is_solution ~}} - internal class {{ name }}(SolutionModel model, AbsolutePath path) : Fallout.Solutions.Solution(model, path) - {{~ else ~}} - internal class {{ name }}(SolutionFolderModel model, Fallout.Solutions.Solution solution) : Fallout.Solutions.SolutionFolder(model, solution) - {{~ end ~}} - { - {{~ for project in projects ~}} - public Fallout.Solutions.Project {{ project.escaped_name }} => this.GetProject("{{ project.name }}"); - {{~ end ~}} - - {{~ for folder in folders ~}} - public {{ folder.type_name }} {{ folder.escaped_name }} => Unsafe.As<{{ folder.type_name }}>(this.GetSolutionFolder("{{ folder.name }}")); - {{~ end ~}} - - {{~ for declaration in declarations ~}} - {{ declaration }} - {{~ end ~}} - } - """); - return template.Render(model); - - // C# identifiers can't start with a digit and can only contain - // letters/digits/underscore. The old regex `(^[\W^\d]|[\W])` was - // attempting both but the `^\d` inside the character class was - // misread as "match `^` or `\d`" rather than "starts with digit". - // Folders like `00-Build` produced invalid output. Upstream fix - // from nuke-build/nuke#1581. - string GetEscapedName(string name) - { - name = name - // .Replace(".", fancyNaming ? "丨" : "_") - .Replace(".", fancyNaming ? "٠" : "_") - .ReplaceRegex(@"[^A-Za-z0-9_]", _ => "_"); - - if (Regex.IsMatch(name, @"^[0-9]")) - return "_" + name; - - return name; - } - } + context.AddSource(member.Name + ".g.cs", SolutionEmitter.Emit(solution, member.Name, fancyNaming)); } } catch (Exception exception) diff --git a/src/shared/SolutionEmitter.cs b/src/shared/SolutionEmitter.cs new file mode 100644 index 000000000..9e934de2b --- /dev/null +++ b/src/shared/SolutionEmitter.cs @@ -0,0 +1,101 @@ +using System; +using System.Linq; +using System.Text.RegularExpressions; +using Fallout.Common.Utilities; +using Fallout.Common.Utilities.Collections; +using Scriban; + +namespace Fallout.Solutions; + +/// +/// Shared emit logic for the strongly-typed [Solution] accessor (Solution.g.cs). +/// Compiled (via linked source) into both the in-compiler StronglyTypedSolutionGenerator +/// (the toggle fallback) and the net10 pre-build Fallout.Solution.Codegen console (the +/// default), so the two paths produce byte-identical output. +/// +internal static class SolutionEmitter +{ + public static string Emit(Solution solution, string memberName, bool fancyNaming) + { + var declaration = GetDeclaration(solution); + + // lang=csharp + return $""" + // + + using Fallout.Persistence.Solution.Model; + using Fallout.Solutions; + using Fallout.Common.IO; + using System.Runtime.CompilerServices; + + {declaration} + """; + + string GetDeclaration(IProjectContainer container, string folderName = null) + { + var prefix = new string('_', container.Descendants(x => x.Parent).Count() + 1); + var model = new + { + IsSolution = container is Solution, + SolutionReference = container is Solution ? "this" : "solution", + Name = GetEscapedName(container switch + { + Solution => memberName, + SolutionFolder folder => folderName ?? folder.Name, + _ => throw new ArgumentOutOfRangeException(nameof(container), container, null) + }), + Projects = container.Projects.OrderBy(x => x.Name).Select(x => new + { + x.Name, + EscapedName = GetEscapedName(x.Name), + }), + Folders = container.SolutionFolders.OrderBy(x => x.Name).Select(x => new + { + x.Name, + TypeName = $"{prefix}{GetEscapedName(x.Name)}", + EscapedName = GetEscapedName(x.Name), + }), + Declarations = container.SolutionFolders.OrderBy(x => x.Name) + .Select(x => GetDeclaration(x, $"{prefix}{GetEscapedName(x.Name)}")).ToArray(), + }; + + // lang=csharp + var template = Template.Parse(""" + {{~ if is_solution ~}} + internal class {{ name }}(SolutionModel model, AbsolutePath path) : Fallout.Solutions.Solution(model, path) + {{~ else ~}} + internal class {{ name }}(SolutionFolderModel model, Fallout.Solutions.Solution solution) : Fallout.Solutions.SolutionFolder(model, solution) + {{~ end ~}} + { + {{~ for project in projects ~}} + public Fallout.Solutions.Project {{ project.escaped_name }} => this.GetProject("{{ project.name }}"); + {{~ end ~}} + + {{~ for folder in folders ~}} + public {{ folder.type_name }} {{ folder.escaped_name }} => Unsafe.As<{{ folder.type_name }}>(this.GetSolutionFolder("{{ folder.name }}")); + {{~ end ~}} + + {{~ for declaration in declarations ~}} + {{ declaration }} + {{~ end ~}} + } + """); + return template.Render(model); + + // C# identifiers can't start with a digit and can only contain + // letters/digits/underscore. Folders like `00-Build` would otherwise + // produce invalid output (nuke-build/nuke#1581). + string GetEscapedName(string name) + { + name = name + .Replace(".", fancyNaming ? "٠" : "_") + .ReplaceRegex(@"[^A-Za-z0-9_]", _ => "_"); + + if (Regex.IsMatch(name, @"^[0-9]")) + return "_" + name; + + return name; + } + } + } +} diff --git a/tests/Consumers/README.md b/tests/Consumers/README.md index f75febc7d..1501019f7 100644 --- a/tests/Consumers/README.md +++ b/tests/Consumers/README.md @@ -46,8 +46,8 @@ The `Nuke.Consumer` doesn't pin anything (it references the in-repo shim assembl ## What's NOT tested - Actual build *execution* (see above — runtime activation is fragile) -- CI-host integration (GitHubActions, AzurePipelines, etc.) — covered by `tests/Fallout.Common.Tests/CI/` +- CI-host integration (GitHubActions, AzurePipelines, etc.) — covered by `tests/Fallout.Common.Specs/CI/` - Tool wrappers — covered by their own generated tests -- Source generator behaviour — covered by `tests/Fallout.SourceGenerators.Tests/` +- Source generator behaviour — covered by `tests/Fallout.SourceGenerators.Specs/` These consumer projects are a **sentinel for shape changes**, not a place to demo features. Don't add consumer projects covering specific subsystems — those go in their own focused tests. diff --git a/tests/Fallout.Build.Tests/BuildExecutorTest.cs b/tests/Fallout.Build.Specs/BuildExecutorSpecs.cs similarity index 98% rename from tests/Fallout.Build.Tests/BuildExecutorTest.cs rename to tests/Fallout.Build.Specs/BuildExecutorSpecs.cs index 98728a01b..00b8b9484 100644 --- a/tests/Fallout.Build.Tests/BuildExecutorTest.cs +++ b/tests/Fallout.Build.Specs/BuildExecutorSpecs.cs @@ -1,19 +1,19 @@ -using System; +using System; using System.Linq; using FluentAssertions; using Fallout.Common.Execution; using Fallout.Common.Utilities.Collections; using Xunit; -namespace Fallout.Common.Tests.Execution; +namespace Fallout.Common.Specs.Execution; -public class BuildExecutorTest +public class BuildExecutorSpecs { private ExecutableTarget A = new() { Name = nameof(A), Status = ExecutionStatus.Scheduled }; private ExecutableTarget B = new() { Name = nameof(B), Status = ExecutionStatus.Scheduled }; private ExecutableTarget C = new() { Name = nameof(C), Status = ExecutionStatus.Scheduled }; - public BuildExecutorTest() + public BuildExecutorSpecs() { C.ExecutionDependencies.Add(B); B.ExecutionDependencies.Add(A); diff --git a/tests/Fallout.Build.Tests/CompletionUtilityTest.TestGetCompletionItemsFromSchema.verified.txt b/tests/Fallout.Build.Specs/CompletionUtilitySpecs.TestGetCompletionItemsFromSchema.verified.txt similarity index 100% rename from tests/Fallout.Build.Tests/CompletionUtilityTest.TestGetCompletionItemsFromSchema.verified.txt rename to tests/Fallout.Build.Specs/CompletionUtilitySpecs.TestGetCompletionItemsFromSchema.verified.txt diff --git a/tests/Fallout.Build.Tests/CompletionUtilityTest.TestGetCompletionItemsParameterBuild.verified.txt b/tests/Fallout.Build.Specs/CompletionUtilitySpecs.TestGetCompletionItemsParameterBuild.verified.txt similarity index 100% rename from tests/Fallout.Build.Tests/CompletionUtilityTest.TestGetCompletionItemsParameterBuild.verified.txt rename to tests/Fallout.Build.Specs/CompletionUtilitySpecs.TestGetCompletionItemsParameterBuild.verified.txt diff --git a/tests/Fallout.Build.Tests/CompletionUtilityTest.TestGetCompletionItemsTargetBuild.verified.txt b/tests/Fallout.Build.Specs/CompletionUtilitySpecs.TestGetCompletionItemsTargetBuild.verified.txt similarity index 100% rename from tests/Fallout.Build.Tests/CompletionUtilityTest.TestGetCompletionItemsTargetBuild.verified.txt rename to tests/Fallout.Build.Specs/CompletionUtilitySpecs.TestGetCompletionItemsTargetBuild.verified.txt diff --git a/tests/Fallout.Build.Tests/CompletionUtilityTest.cs b/tests/Fallout.Build.Specs/CompletionUtilitySpecs.cs similarity index 93% rename from tests/Fallout.Build.Tests/CompletionUtilityTest.cs rename to tests/Fallout.Build.Specs/CompletionUtilitySpecs.cs index 6a60cd592..9212cf01d 100644 --- a/tests/Fallout.Build.Tests/CompletionUtilityTest.cs +++ b/tests/Fallout.Build.Specs/CompletionUtilitySpecs.cs @@ -10,15 +10,15 @@ using VerifyXunit; using Xunit; -namespace Fallout.Common.Tests; +namespace Fallout.Common.Specs; -public class CompletionUtilityTest +public class CompletionUtilitySpecs { private readonly VerifySettings _verifySettings; private static AbsolutePath RootDirectory => Constants.TryGetRootDirectoryFrom(EnvironmentInfo.WorkingDirectory).NotNull(); - private static AbsolutePath TestDirectory => RootDirectory / "tests" / "Fallout.Build.Tests"; + private static AbsolutePath TestDirectory => RootDirectory / "tests" / "Fallout.Build.Specs"; - public CompletionUtilityTest() + public CompletionUtilitySpecs() { _verifySettings = new VerifySettings(); _verifySettings.DontIgnoreEmptyCollections(); @@ -27,7 +27,7 @@ public CompletionUtilityTest() [Fact] public async Task TestGetCompletionItemsTargetBuild() { - var file = TestDirectory / "SchemaUtilityTest.TestTargetBuild.verified.json"; + var file = TestDirectory / "SchemaUtilitySpecs.TestTargetBuild.verified.json"; var schema = JsonDocument.Parse(file.ReadAllText()); var items = CompletionUtility.GetItemsFromSchema(schema, new[] { "dev" }); await Verifier.Verify(items, _verifySettings); @@ -36,7 +36,7 @@ public async Task TestGetCompletionItemsTargetBuild() [Fact] public async Task TestGetCompletionItemsParameterBuild() { - var file = TestDirectory / "SchemaUtilityTest.TestParameterBuild.verified.json"; + var file = TestDirectory / "SchemaUtilitySpecs.TestParameterBuild.verified.json"; var schema = JsonDocument.Parse(file.ReadAllText()); var items = CompletionUtility.GetItemsFromSchema(schema, []); await Verifier.Verify(items, _verifySettings); diff --git a/tests/Fallout.Build.Tests/ControlFlowTest.cs b/tests/Fallout.Build.Specs/ControlFlowSpecs.cs similarity index 88% rename from tests/Fallout.Build.Tests/ControlFlowTest.cs rename to tests/Fallout.Build.Specs/ControlFlowSpecs.cs index d995cbbfb..8d35a70f3 100644 --- a/tests/Fallout.Build.Tests/ControlFlowTest.cs +++ b/tests/Fallout.Build.Specs/ControlFlowSpecs.cs @@ -5,9 +5,9 @@ // ReSharper disable ArgumentsStyleLiteral -namespace Fallout.Common.Tests; +namespace Fallout.Common.Specs; -public class ControlFlowTest +public class ControlFlowSpecs { [Fact] public void Test() diff --git a/tests/Fallout.Build.Tests/DefaultInterfaceExecutionTest.cs b/tests/Fallout.Build.Specs/DefaultInterfaceExecutionSpecs.cs similarity index 93% rename from tests/Fallout.Build.Tests/DefaultInterfaceExecutionTest.cs rename to tests/Fallout.Build.Specs/DefaultInterfaceExecutionSpecs.cs index 722dc70cf..e5f46616b 100644 --- a/tests/Fallout.Build.Tests/DefaultInterfaceExecutionTest.cs +++ b/tests/Fallout.Build.Specs/DefaultInterfaceExecutionSpecs.cs @@ -1,13 +1,13 @@ -using System; +using System; using System.Linq; using System.Linq.Expressions; using FluentAssertions; using Fallout.Common.Execution; using Xunit; -namespace Fallout.Common.Tests.Execution; +namespace Fallout.Common.Specs.Execution; -public class DefaultInterfaceExecutionTest +public class DefaultInterfaceExecutionSpecs { public static string Description = "description"; public static Action Action = () => { }; @@ -185,15 +185,11 @@ private class OverriddenDuplicatedTargetTestBuild : FalloutBuild, ITestBuild, ID private interface ITestBuild { - string Description => DefaultInterfaceExecutionTest.Description; - - Action Action => DefaultInterfaceExecutionTest.Action; - - Expression> Requirement => DefaultInterfaceExecutionTest.Requirement; - - Func StaticCondition => DefaultInterfaceExecutionTest.StaticCondition; - - Func DynamicCondition => DefaultInterfaceExecutionTest.DynamicCondition; + public string Description => DefaultInterfaceExecutionSpecs.Description; + public Action Action => DefaultInterfaceExecutionSpecs.Action; + public Expression> Requirement => DefaultInterfaceExecutionSpecs.Requirement; + public Func StaticCondition => DefaultInterfaceExecutionSpecs.StaticCondition; + public Func DynamicCondition => DefaultInterfaceExecutionSpecs.DynamicCondition; Target A => _ => _ .Description(Description) diff --git a/tests/Fallout.Build.Tests/ExecutableTargetFactoryTest.cs b/tests/Fallout.Build.Specs/ExecutableTargetFactorySpecs.cs similarity index 98% rename from tests/Fallout.Build.Tests/ExecutableTargetFactoryTest.cs rename to tests/Fallout.Build.Specs/ExecutableTargetFactorySpecs.cs index 168797267..668117743 100644 --- a/tests/Fallout.Build.Tests/ExecutableTargetFactoryTest.cs +++ b/tests/Fallout.Build.Specs/ExecutableTargetFactorySpecs.cs @@ -5,9 +5,9 @@ using Fallout.Common.Execution; using Xunit; -namespace Fallout.Common.Tests.Execution; +namespace Fallout.Common.Specs.Execution; -public class ExecutableTargetFactoryTest +public class ExecutableTargetFactorySpecs { [Fact] public void Test() diff --git a/tests/Fallout.Build.Tests/ExecutionPlannerTest.cs b/tests/Fallout.Build.Specs/ExecutionPlannerSpecs.cs similarity index 97% rename from tests/Fallout.Build.Tests/ExecutionPlannerTest.cs rename to tests/Fallout.Build.Specs/ExecutionPlannerSpecs.cs index b8e51e94f..1586198d3 100644 --- a/tests/Fallout.Build.Tests/ExecutionPlannerTest.cs +++ b/tests/Fallout.Build.Specs/ExecutionPlannerSpecs.cs @@ -5,9 +5,9 @@ using Fallout.Common.Execution; using Xunit; -namespace Fallout.Common.Tests.Execution; +namespace Fallout.Common.Specs.Execution; -public class ExecutionPlannerTest +public class ExecutionPlannerSpecs { private ExecutableTarget A = new() { Name = nameof(A), IsDefault = true }; private ExecutableTarget B = new() { Name = nameof(B) }; diff --git a/tests/Fallout.Build.Tests/ExecutionTestsInitializer.cs b/tests/Fallout.Build.Specs/ExecutionSpecsInitializer.cs similarity index 85% rename from tests/Fallout.Build.Tests/ExecutionTestsInitializer.cs rename to tests/Fallout.Build.Specs/ExecutionSpecsInitializer.cs index 30ec8acd4..8f39f1338 100644 --- a/tests/Fallout.Build.Tests/ExecutionTestsInitializer.cs +++ b/tests/Fallout.Build.Specs/ExecutionSpecsInitializer.cs @@ -1,9 +1,9 @@ -using System; +using System; using System.Linq; using System.Runtime.CompilerServices; using Fallout.Common.Execution; -namespace Fallout.Common.Tests; +namespace Fallout.Common.Specs; public static class ExecutionTestsInitializer { diff --git a/tests/Fallout.Build.Tests/Fallout.Build.Tests.csproj b/tests/Fallout.Build.Specs/Fallout.Build.Specs.csproj similarity index 100% rename from tests/Fallout.Build.Tests/Fallout.Build.Tests.csproj rename to tests/Fallout.Build.Specs/Fallout.Build.Specs.csproj diff --git a/tests/Fallout.Build.Tests/GitRepositoryTest.cs b/tests/Fallout.Build.Specs/GitRepositorySpecs.cs similarity index 91% rename from tests/Fallout.Build.Tests/GitRepositoryTest.cs rename to tests/Fallout.Build.Specs/GitRepositorySpecs.cs index 6fa952f64..02f326352 100644 --- a/tests/Fallout.Build.Tests/GitRepositoryTest.cs +++ b/tests/Fallout.Build.Specs/GitRepositorySpecs.cs @@ -1,13 +1,13 @@ -using System; +using System; using System.IO; using System.Linq; using FluentAssertions; using Fallout.Common.Git; using Xunit; -namespace Fallout.Common.Tests; +namespace Fallout.Common.Specs; -public class GitRepositoryTest +public class GitRepositorySpecs { [Theory] [InlineData("https://github.com/nuke-build", "github.com", "nuke-build")] @@ -27,7 +27,7 @@ public class GitRepositoryTest [InlineData("https://git.test.org:1234/test/test", "git.test.org", "test/test")] [InlineData("git://git.test.org:1234/test/test", "git.test.org", "test/test")] [InlineData("git://git.test.org/test/test", "git.test.org", "test/test")] - public void FromUrlTest(string url, string endpoint, string identifier) + public void FromUrlSpec(string url, string endpoint, string identifier) { var repository = GitRepository.FromUrl(url); repository.Endpoint.Should().Be(endpoint); @@ -39,14 +39,14 @@ public void FromUrlTest(string url, string endpoint, string identifier) [InlineData("git@git.test.org:test", GitProtocol.Ssh)] [InlineData("ssh://git.test.org:1234/test/test", GitProtocol.Ssh)] [InlineData("git://git.test.org:1234/test/test", GitProtocol.Ssh)] - public void FromUrlProtocolTest(string url, GitProtocol protocol) + public void FromUrlProtocolSpec(string url, GitProtocol protocol) { var repository = GitRepository.FromUrl(url); repository.Protocol.Should().Be(protocol); } [Fact] - public void FromDirectoryTest() + public void FromDirectorySpec() { var repository = GitRepository.FromLocalDirectory(Directory.GetCurrentDirectory()).NotNull(); repository.Endpoint.Should().NotBeNullOrEmpty(); diff --git a/tests/Fallout.Build.Tests/HostInitializer.cs b/tests/Fallout.Build.Specs/HostInitializer.cs similarity index 90% rename from tests/Fallout.Build.Tests/HostInitializer.cs rename to tests/Fallout.Build.Specs/HostInitializer.cs index 05bfd7f54..730047626 100644 --- a/tests/Fallout.Build.Tests/HostInitializer.cs +++ b/tests/Fallout.Build.Specs/HostInitializer.cs @@ -1,9 +1,9 @@ -using System; +using System; using System.Linq; using System.Runtime.CompilerServices; using Fallout.Common.Utilities; -namespace Fallout.Common.Tests; +namespace Fallout.Common.Specs; public static class HostInitializer { diff --git a/tests/Fallout.Build.Tests/ParameterServiceTest.cs b/tests/Fallout.Build.Specs/ParameterServiceSpecs.cs similarity index 98% rename from tests/Fallout.Build.Tests/ParameterServiceTest.cs rename to tests/Fallout.Build.Specs/ParameterServiceSpecs.cs index 92a2618cf..ef7dd981e 100644 --- a/tests/Fallout.Build.Tests/ParameterServiceTest.cs +++ b/tests/Fallout.Build.Specs/ParameterServiceSpecs.cs @@ -7,9 +7,9 @@ using Xunit; using static Fallout.Common.Utilities.ReflectionUtility; -namespace Fallout.Common.Tests; +namespace Fallout.Common.Specs; -public class ParameterServiceTest +public class ParameterServiceSpecs { private ParameterService GetService(string[] commandLineArguments = null, IDictionary environmentVariables = null) { diff --git a/tests/Fallout.Build.Tests/SchemaUtilityTest.TestCustomParameterAttribute.verified.json b/tests/Fallout.Build.Specs/SchemaUtilitySpecs.TestCustomParameterAttribute.verified.json similarity index 100% rename from tests/Fallout.Build.Tests/SchemaUtilityTest.TestCustomParameterAttribute.verified.json rename to tests/Fallout.Build.Specs/SchemaUtilitySpecs.TestCustomParameterAttribute.verified.json diff --git a/tests/Fallout.Build.Tests/SchemaUtilityTest.TestEmptyBuild.verified.json b/tests/Fallout.Build.Specs/SchemaUtilitySpecs.TestEmptyBuild.verified.json similarity index 100% rename from tests/Fallout.Build.Tests/SchemaUtilityTest.TestEmptyBuild.verified.json rename to tests/Fallout.Build.Specs/SchemaUtilitySpecs.TestEmptyBuild.verified.json diff --git a/tests/Fallout.Build.Tests/SchemaUtilityTest.TestGetBuildSchema.verified.json b/tests/Fallout.Build.Specs/SchemaUtilitySpecs.TestGetBuildSchema.verified.json similarity index 100% rename from tests/Fallout.Build.Tests/SchemaUtilityTest.TestGetBuildSchema.verified.json rename to tests/Fallout.Build.Specs/SchemaUtilitySpecs.TestGetBuildSchema.verified.json diff --git a/tests/Fallout.Build.Tests/SchemaUtilityTest.TestParameterBuild.verified.json b/tests/Fallout.Build.Specs/SchemaUtilitySpecs.TestParameterBuild.verified.json similarity index 100% rename from tests/Fallout.Build.Tests/SchemaUtilityTest.TestParameterBuild.verified.json rename to tests/Fallout.Build.Specs/SchemaUtilitySpecs.TestParameterBuild.verified.json diff --git a/tests/Fallout.Build.Tests/SchemaUtilityTest.TestTargetBuild.verified.json b/tests/Fallout.Build.Specs/SchemaUtilitySpecs.TestTargetBuild.verified.json similarity index 100% rename from tests/Fallout.Build.Tests/SchemaUtilityTest.TestTargetBuild.verified.json rename to tests/Fallout.Build.Specs/SchemaUtilitySpecs.TestTargetBuild.verified.json diff --git a/tests/Fallout.Build.Tests/SchemaUtilityTest.cs b/tests/Fallout.Build.Specs/SchemaUtilitySpecs.cs similarity index 97% rename from tests/Fallout.Build.Tests/SchemaUtilityTest.cs rename to tests/Fallout.Build.Specs/SchemaUtilitySpecs.cs index 745585966..106a1ef41 100644 --- a/tests/Fallout.Build.Tests/SchemaUtilityTest.cs +++ b/tests/Fallout.Build.Specs/SchemaUtilitySpecs.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.ComponentModel; using System.Linq; using System.Threading.Tasks; @@ -11,9 +11,9 @@ #pragma warning disable CS0169 // Field is never used -namespace Fallout.Common.Tests; +namespace Fallout.Common.Specs; -public class SchemaUtilityTest +public class SchemaUtilitySpecs { [Fact] public Task TestEmptyBuild() diff --git a/tests/Fallout.Cli.Tests/VerifyTestsInitializer.cs b/tests/Fallout.Build.Specs/VerifySpecsInitializer.cs similarity index 89% rename from tests/Fallout.Cli.Tests/VerifyTestsInitializer.cs rename to tests/Fallout.Build.Specs/VerifySpecsInitializer.cs index 3f4852254..ff5f8c9a5 100644 --- a/tests/Fallout.Cli.Tests/VerifyTestsInitializer.cs +++ b/tests/Fallout.Build.Specs/VerifySpecsInitializer.cs @@ -1,9 +1,9 @@ -using System; +using System; using System.Linq; using System.Runtime.CompilerServices; using VerifyTests; -namespace Fallout.Cli.Tests; +namespace Fallout.Common.Specs; public static class VerifyTestsInitializer { diff --git a/tests/Fallout.Build.Tests/parameters.json b/tests/Fallout.Build.Specs/parameters.json similarity index 54% rename from tests/Fallout.Build.Tests/parameters.json rename to tests/Fallout.Build.Specs/parameters.json index 0b2ee0afb..1d765acc2 100644 --- a/tests/Fallout.Build.Tests/parameters.json +++ b/tests/Fallout.Build.Specs/parameters.json @@ -1,5 +1,5 @@ { - "$schema": "./SchemaUtilityTest.TestTargetBuild.verified.json", + "$schema": "./SchemaUtilitySpecs.TestTargetBuild.verified.json", "Verbosity": "Minimal", "Target": ["ExplicitTarget", "InheritedTarget"] } diff --git a/tests/Fallout.Cli.Tests/BuildProjectResolverTests.cs b/tests/Fallout.Cli.Specs/BuildProjectResolverSpecs.cs similarity index 98% rename from tests/Fallout.Cli.Tests/BuildProjectResolverTests.cs rename to tests/Fallout.Cli.Specs/BuildProjectResolverSpecs.cs index 21d2a120d..679c86075 100644 --- a/tests/Fallout.Cli.Tests/BuildProjectResolverTests.cs +++ b/tests/Fallout.Cli.Specs/BuildProjectResolverSpecs.cs @@ -5,9 +5,9 @@ using FluentAssertions; using Xunit; -namespace Fallout.Cli.Tests; +namespace Fallout.Cli.Specs; -public class BuildProjectResolverTests +public class BuildProjectResolverSpecs { [Fact] public void Resolve_ConventionDefault_ReturnsBuildSlashUnderscoreBuildCsproj() diff --git a/tests/Fallout.Cli.Tests/CakeConversionTests.cs b/tests/Fallout.Cli.Specs/CakeConversionSpecs.cs similarity index 90% rename from tests/Fallout.Cli.Tests/CakeConversionTests.cs rename to tests/Fallout.Cli.Specs/CakeConversionSpecs.cs index 8357034f7..9e999a6da 100644 --- a/tests/Fallout.Cli.Tests/CakeConversionTests.cs +++ b/tests/Fallout.Cli.Specs/CakeConversionSpecs.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using FluentAssertions; @@ -8,9 +8,9 @@ using VerifyXunit; using Xunit; -namespace Fallout.Cli.Tests; +namespace Fallout.Cli.Specs; -public class CakeConversionTests +public class CakeConversionSpecs { private static AbsolutePath RootDirectory => Constants.TryGetRootDirectoryFrom(EnvironmentInfo.WorkingDirectory); @@ -37,7 +37,7 @@ public void TestPackages() packages.Should().NotContain(x => x.Id.Contains("Cake")); } - private static AbsolutePath CakeScriptsDirectory => RootDirectory / "tests" / "Fallout.Cli.Tests" / "cake-scripts"; + private static AbsolutePath CakeScriptsDirectory => RootDirectory / "tests" / "Fallout.Cli.Specs" / "cake-scripts"; public static IEnumerable CakeFileNames => CakeScriptsDirectory.GlobFiles(Program.CAKE_FILE_PATTERN).Select(x => new object[] { x }); diff --git a/tests/Fallout.Cli.Tests/Fallout.Cli.Tests.csproj b/tests/Fallout.Cli.Specs/Fallout.Cli.Specs.csproj similarity index 100% rename from tests/Fallout.Cli.Tests/Fallout.Cli.Tests.csproj rename to tests/Fallout.Cli.Specs/Fallout.Cli.Specs.csproj diff --git a/tests/Fallout.Cli.Tests/UpdateSolutionFileContentTests.Test_number=1.verified.txt b/tests/Fallout.Cli.Specs/UpdateSolutionFileContentSpecs.Test_number=1.verified.txt similarity index 100% rename from tests/Fallout.Cli.Tests/UpdateSolutionFileContentTests.Test_number=1.verified.txt rename to tests/Fallout.Cli.Specs/UpdateSolutionFileContentSpecs.Test_number=1.verified.txt diff --git a/tests/Fallout.Cli.Tests/UpdateSolutionFileContentTests.Test_number=2.verified.txt b/tests/Fallout.Cli.Specs/UpdateSolutionFileContentSpecs.Test_number=2.verified.txt similarity index 100% rename from tests/Fallout.Cli.Tests/UpdateSolutionFileContentTests.Test_number=2.verified.txt rename to tests/Fallout.Cli.Specs/UpdateSolutionFileContentSpecs.Test_number=2.verified.txt diff --git a/tests/Fallout.Cli.Tests/UpdateSolutionFileContentTests.Test_number=3.verified.txt b/tests/Fallout.Cli.Specs/UpdateSolutionFileContentSpecs.Test_number=3.verified.txt similarity index 100% rename from tests/Fallout.Cli.Tests/UpdateSolutionFileContentTests.Test_number=3.verified.txt rename to tests/Fallout.Cli.Specs/UpdateSolutionFileContentSpecs.Test_number=3.verified.txt diff --git a/tests/Fallout.Cli.Tests/UpdateSolutionFileContentTests.cs b/tests/Fallout.Cli.Specs/UpdateSolutionFileContentSpecs.cs similarity index 98% rename from tests/Fallout.Cli.Tests/UpdateSolutionFileContentTests.cs rename to tests/Fallout.Cli.Specs/UpdateSolutionFileContentSpecs.cs index 0663a166b..8963c84a0 100644 --- a/tests/Fallout.Cli.Tests/UpdateSolutionFileContentTests.cs +++ b/tests/Fallout.Cli.Specs/UpdateSolutionFileContentSpecs.cs @@ -5,9 +5,9 @@ using VerifyXunit; using Xunit; -namespace Fallout.Cli.Tests; +namespace Fallout.Cli.Specs; -public class UpdateSolutionFileContentTests +public class UpdateSolutionFileContentSpecs { [Theory] [InlineData( diff --git a/tests/Fallout.Build.Tests/VerifyTestsInitializer.cs b/tests/Fallout.Cli.Specs/VerifySpecsInitializer.cs similarity index 88% rename from tests/Fallout.Build.Tests/VerifyTestsInitializer.cs rename to tests/Fallout.Cli.Specs/VerifySpecsInitializer.cs index 661d4b232..aa3f89b70 100644 --- a/tests/Fallout.Build.Tests/VerifyTestsInitializer.cs +++ b/tests/Fallout.Cli.Specs/VerifySpecsInitializer.cs @@ -1,9 +1,9 @@ -using System; +using System; using System.Linq; using System.Runtime.CompilerServices; using VerifyTests; -namespace Fallout.Common.Tests; +namespace Fallout.Cli.Specs; public static class VerifyTestsInitializer { diff --git a/tests/Fallout.Cli.Tests/cake-scripts/default-target.cake b/tests/Fallout.Cli.Specs/cake-scripts/default-target.cake similarity index 100% rename from tests/Fallout.Cli.Tests/cake-scripts/default-target.cake rename to tests/Fallout.Cli.Specs/cake-scripts/default-target.cake diff --git a/tests/Fallout.Cli.Tests/cake-scripts/default-target.verified.cs b/tests/Fallout.Cli.Specs/cake-scripts/default-target.verified.cs similarity index 100% rename from tests/Fallout.Cli.Tests/cake-scripts/default-target.verified.cs rename to tests/Fallout.Cli.Specs/cake-scripts/default-target.verified.cs diff --git a/tests/Fallout.Cli.Tests/cake-scripts/globbing.cake b/tests/Fallout.Cli.Specs/cake-scripts/globbing.cake similarity index 100% rename from tests/Fallout.Cli.Tests/cake-scripts/globbing.cake rename to tests/Fallout.Cli.Specs/cake-scripts/globbing.cake diff --git a/tests/Fallout.Cli.Tests/cake-scripts/globbing.verified.cs b/tests/Fallout.Cli.Specs/cake-scripts/globbing.verified.cs similarity index 100% rename from tests/Fallout.Cli.Tests/cake-scripts/globbing.verified.cs rename to tests/Fallout.Cli.Specs/cake-scripts/globbing.verified.cs diff --git a/tests/Fallout.Cli.Tests/cake-scripts/parameters.cake b/tests/Fallout.Cli.Specs/cake-scripts/parameters.cake similarity index 100% rename from tests/Fallout.Cli.Tests/cake-scripts/parameters.cake rename to tests/Fallout.Cli.Specs/cake-scripts/parameters.cake diff --git a/tests/Fallout.Cli.Tests/cake-scripts/parameters.verified.cs b/tests/Fallout.Cli.Specs/cake-scripts/parameters.verified.cs similarity index 100% rename from tests/Fallout.Cli.Tests/cake-scripts/parameters.verified.cs rename to tests/Fallout.Cli.Specs/cake-scripts/parameters.verified.cs diff --git a/tests/Fallout.Cli.Tests/cake-scripts/paths.cake b/tests/Fallout.Cli.Specs/cake-scripts/paths.cake similarity index 100% rename from tests/Fallout.Cli.Tests/cake-scripts/paths.cake rename to tests/Fallout.Cli.Specs/cake-scripts/paths.cake diff --git a/tests/Fallout.Cli.Tests/cake-scripts/paths.verified.cs b/tests/Fallout.Cli.Specs/cake-scripts/paths.verified.cs similarity index 100% rename from tests/Fallout.Cli.Tests/cake-scripts/paths.verified.cs rename to tests/Fallout.Cli.Specs/cake-scripts/paths.verified.cs diff --git a/tests/Fallout.Cli.Tests/cake-scripts/references.cake b/tests/Fallout.Cli.Specs/cake-scripts/references.cake similarity index 100% rename from tests/Fallout.Cli.Tests/cake-scripts/references.cake rename to tests/Fallout.Cli.Specs/cake-scripts/references.cake diff --git a/tests/Fallout.Cli.Tests/cake-scripts/references.verified.cs b/tests/Fallout.Cli.Specs/cake-scripts/references.verified.cs similarity index 100% rename from tests/Fallout.Cli.Tests/cake-scripts/references.verified.cs rename to tests/Fallout.Cli.Specs/cake-scripts/references.verified.cs diff --git a/tests/Fallout.Cli.Tests/cake-scripts/targets.cake b/tests/Fallout.Cli.Specs/cake-scripts/targets.cake similarity index 100% rename from tests/Fallout.Cli.Tests/cake-scripts/targets.cake rename to tests/Fallout.Cli.Specs/cake-scripts/targets.cake diff --git a/tests/Fallout.Cli.Tests/cake-scripts/targets.verified.cs b/tests/Fallout.Cli.Specs/cake-scripts/targets.verified.cs similarity index 100% rename from tests/Fallout.Cli.Tests/cake-scripts/targets.verified.cs rename to tests/Fallout.Cli.Specs/cake-scripts/targets.verified.cs diff --git a/tests/Fallout.Cli.Tests/cake-scripts/tool-invocation.cake b/tests/Fallout.Cli.Specs/cake-scripts/tool-invocation.cake similarity index 100% rename from tests/Fallout.Cli.Tests/cake-scripts/tool-invocation.cake rename to tests/Fallout.Cli.Specs/cake-scripts/tool-invocation.cake diff --git a/tests/Fallout.Cli.Tests/cake-scripts/tool-invocation.verified.cs b/tests/Fallout.Cli.Specs/cake-scripts/tool-invocation.verified.cs similarity index 99% rename from tests/Fallout.Cli.Tests/cake-scripts/tool-invocation.verified.cs rename to tests/Fallout.Cli.Specs/cake-scripts/tool-invocation.verified.cs index 0368b35c4..e84fe7972 100644 --- a/tests/Fallout.Cli.Tests/cake-scripts/tool-invocation.verified.cs +++ b/tests/Fallout.Cli.Specs/cake-scripts/tool-invocation.verified.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.IO; using System.Linq; diff --git a/tests/Fallout.Common.Tests/CI/ConfigurationGenerationTest.Test_testName=checkout-ref_attribute=GitHubActionsAttribute.verified.txt b/tests/Fallout.Common.Specs/CI/ConfigurationGenerationSpecs.Test_testName=checkout-ref_attribute=GitHubActionsAttribute.verified.txt similarity index 100% rename from tests/Fallout.Common.Tests/CI/ConfigurationGenerationTest.Test_testName=checkout-ref_attribute=GitHubActionsAttribute.verified.txt rename to tests/Fallout.Common.Specs/CI/ConfigurationGenerationSpecs.Test_testName=checkout-ref_attribute=GitHubActionsAttribute.verified.txt diff --git a/tests/Fallout.Common.Tests/CI/ConfigurationGenerationTest.Test_testName=detailed-triggers_attribute=GitHubActionsAttribute.verified.txt b/tests/Fallout.Common.Specs/CI/ConfigurationGenerationSpecs.Test_testName=detailed-triggers_attribute=GitHubActionsAttribute.verified.txt similarity index 100% rename from tests/Fallout.Common.Tests/CI/ConfigurationGenerationTest.Test_testName=detailed-triggers_attribute=GitHubActionsAttribute.verified.txt rename to tests/Fallout.Common.Specs/CI/ConfigurationGenerationSpecs.Test_testName=detailed-triggers_attribute=GitHubActionsAttribute.verified.txt diff --git a/tests/Fallout.Common.Tests/CI/ConfigurationGenerationTest.Test_testName=env-block-with-permissions_attribute=GitHubActionsAttribute.verified.txt b/tests/Fallout.Common.Specs/CI/ConfigurationGenerationSpecs.Test_testName=env-block-with-permissions_attribute=GitHubActionsAttribute.verified.txt similarity index 100% rename from tests/Fallout.Common.Tests/CI/ConfigurationGenerationTest.Test_testName=env-block-with-permissions_attribute=GitHubActionsAttribute.verified.txt rename to tests/Fallout.Common.Specs/CI/ConfigurationGenerationSpecs.Test_testName=env-block-with-permissions_attribute=GitHubActionsAttribute.verified.txt diff --git a/tests/Fallout.Common.Tests/CI/ConfigurationGenerationTest.Test_testName=env-block_attribute=GitHubActionsAttribute.verified.txt b/tests/Fallout.Common.Specs/CI/ConfigurationGenerationSpecs.Test_testName=env-block_attribute=GitHubActionsAttribute.verified.txt similarity index 100% rename from tests/Fallout.Common.Tests/CI/ConfigurationGenerationTest.Test_testName=env-block_attribute=GitHubActionsAttribute.verified.txt rename to tests/Fallout.Common.Specs/CI/ConfigurationGenerationSpecs.Test_testName=env-block_attribute=GitHubActionsAttribute.verified.txt diff --git a/tests/Fallout.Common.Tests/CI/ConfigurationGenerationTest.Test_testName=null_attribute=AppVeyorAttribute.verified.txt b/tests/Fallout.Common.Specs/CI/ConfigurationGenerationSpecs.Test_testName=null_attribute=AppVeyorAttribute.verified.txt similarity index 100% rename from tests/Fallout.Common.Tests/CI/ConfigurationGenerationTest.Test_testName=null_attribute=AppVeyorAttribute.verified.txt rename to tests/Fallout.Common.Specs/CI/ConfigurationGenerationSpecs.Test_testName=null_attribute=AppVeyorAttribute.verified.txt diff --git a/tests/Fallout.Common.Tests/CI/ConfigurationGenerationTest.Test_testName=null_attribute=AzurePipelinesAttribute.verified.txt b/tests/Fallout.Common.Specs/CI/ConfigurationGenerationSpecs.Test_testName=null_attribute=AzurePipelinesAttribute.verified.txt similarity index 100% rename from tests/Fallout.Common.Tests/CI/ConfigurationGenerationTest.Test_testName=null_attribute=AzurePipelinesAttribute.verified.txt rename to tests/Fallout.Common.Specs/CI/ConfigurationGenerationSpecs.Test_testName=null_attribute=AzurePipelinesAttribute.verified.txt diff --git a/tests/Fallout.Common.Tests/CI/ConfigurationGenerationTest.Test_testName=null_attribute=SpaceAutomationAttribute.verified.txt b/tests/Fallout.Common.Specs/CI/ConfigurationGenerationSpecs.Test_testName=null_attribute=SpaceAutomationAttribute.verified.txt similarity index 100% rename from tests/Fallout.Common.Tests/CI/ConfigurationGenerationTest.Test_testName=null_attribute=SpaceAutomationAttribute.verified.txt rename to tests/Fallout.Common.Specs/CI/ConfigurationGenerationSpecs.Test_testName=null_attribute=SpaceAutomationAttribute.verified.txt diff --git a/tests/Fallout.Common.Tests/CI/ConfigurationGenerationTest.Test_testName=null_attribute=TeamCityAttribute.verified.txt b/tests/Fallout.Common.Specs/CI/ConfigurationGenerationSpecs.Test_testName=null_attribute=TeamCityAttribute.verified.txt similarity index 100% rename from tests/Fallout.Common.Tests/CI/ConfigurationGenerationTest.Test_testName=null_attribute=TeamCityAttribute.verified.txt rename to tests/Fallout.Common.Specs/CI/ConfigurationGenerationSpecs.Test_testName=null_attribute=TeamCityAttribute.verified.txt diff --git a/tests/Fallout.Common.Specs/CI/ConfigurationGenerationSpecs.Test_testName=runs-on-labels_attribute=GitHubActionsAttribute.verified.txt b/tests/Fallout.Common.Specs/CI/ConfigurationGenerationSpecs.Test_testName=runs-on-labels_attribute=GitHubActionsAttribute.verified.txt new file mode 100644 index 000000000..cdd05c2ca --- /dev/null +++ b/tests/Fallout.Common.Specs/CI/ConfigurationGenerationSpecs.Test_testName=runs-on-labels_attribute=GitHubActionsAttribute.verified.txt @@ -0,0 +1,56 @@ +# ------------------------------------------------------------------------------ +# +# +# This code was generated. +# +# - To turn off auto-generation set: +# +# [TestGitHubActions (AutoGenerate = false)] +# +# - To trigger manual generation invoke: +# +# fallout --generate-configuration GitHubActions_test --host GitHubActions +# +# +# ------------------------------------------------------------------------------ + +name: test + +on: [push] + +jobs: + ubuntu-latest: + name: ubuntu-latest + runs-on: [self-hosted, linux, x64] + steps: + - uses: actions/checkout@v6 + - name: 'Cache: .fallout/temp, ~/.nuget/packages' + uses: actions/cache@v4 + with: + path: | + .fallout/temp + ~/.nuget/packages + key: ${{ runner.os }}-${{ hashFiles('**/global.json', '**/*.csproj', '**/Directory.Packages.props') }} + - name: 'Setup: .NET SDK' + uses: actions/setup-dotnet@v4 + with: + global-json-file: global.json + - name: 'Restore: dotnet tools' + run: dotnet tool restore + - name: 'Run: Test' + run: dotnet fallout Test + - name: 'Publish: src' + uses: actions/upload-artifact@v5 + with: + name: src + path: src + - name: 'Publish: test-results' + uses: actions/upload-artifact@v5 + with: + name: test-results + path: output/test-results + - name: 'Publish: coverage-report.zip' + uses: actions/upload-artifact@v5 + with: + name: coverage-report.zip + path: output/coverage-report.zip diff --git a/tests/Fallout.Common.Tests/CI/ConfigurationGenerationTest.Test_testName=simple-triggers_attribute=GitHubActionsAttribute.verified.txt b/tests/Fallout.Common.Specs/CI/ConfigurationGenerationSpecs.Test_testName=simple-triggers_attribute=GitHubActionsAttribute.verified.txt similarity index 100% rename from tests/Fallout.Common.Tests/CI/ConfigurationGenerationTest.Test_testName=simple-triggers_attribute=GitHubActionsAttribute.verified.txt rename to tests/Fallout.Common.Specs/CI/ConfigurationGenerationSpecs.Test_testName=simple-triggers_attribute=GitHubActionsAttribute.verified.txt diff --git a/tests/Fallout.Common.Tests/CI/ConfigurationGenerationTest.cs b/tests/Fallout.Common.Specs/CI/ConfigurationGenerationSpecs.cs similarity index 96% rename from tests/Fallout.Common.Tests/CI/ConfigurationGenerationTest.cs rename to tests/Fallout.Common.Specs/CI/ConfigurationGenerationSpecs.cs index bbbe05d5a..0c11339a5 100644 --- a/tests/Fallout.Common.Tests/CI/ConfigurationGenerationTest.cs +++ b/tests/Fallout.Common.Specs/CI/ConfigurationGenerationSpecs.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.ComponentModel; using System.IO; @@ -15,9 +15,9 @@ using VerifyXunit; using Xunit; -namespace Fallout.Common.Tests.CI; +namespace Fallout.Common.Specs.CI; -public class ConfigurationGenerationTest +public class ConfigurationGenerationSpecs { [Theory] [MemberData(nameof(GetAttributes))] @@ -212,6 +212,17 @@ public class TestBuild : FalloutBuild } ); + yield return + ( + "runs-on-labels", + new TestGitHubActionsAttribute(GitHubActionsImage.UbuntuLatest) + { + On = new[] { GitHubActionsTrigger.Push }, + InvokedTargets = new[] { nameof(Test) }, + RunsOnLabels = new[] { "self-hosted", "linux", "x64" } + } + ); + yield return ( null, diff --git a/tests/Fallout.Common.Tests/CI/GitHubActionsEnvValidationTest.cs b/tests/Fallout.Common.Specs/CI/GitHubActionsEnvValidationSpecs.cs similarity index 90% rename from tests/Fallout.Common.Tests/CI/GitHubActionsEnvValidationTest.cs rename to tests/Fallout.Common.Specs/CI/GitHubActionsEnvValidationSpecs.cs index 8002193c0..b975d5e04 100644 --- a/tests/Fallout.Common.Tests/CI/GitHubActionsEnvValidationTest.cs +++ b/tests/Fallout.Common.Specs/CI/GitHubActionsEnvValidationSpecs.cs @@ -6,9 +6,9 @@ using FluentAssertions; using Xunit; -namespace Fallout.Common.Tests.CI; +namespace Fallout.Common.Specs.CI; -public class GitHubActionsEnvValidationTest +public class GitHubActionsEnvValidationSpecs { [Theory] [InlineData(null)] @@ -47,13 +47,13 @@ public void Malformed_entry_after_a_valid_one_still_throws() private static void GetConfiguration(string[] env) { - var build = new ConfigurationGenerationTest.TestBuild(); + var build = new ConfigurationGenerationSpecs.TestBuild(); var relevantTargets = ExecutableTargetFactory.CreateAll(build, x => x.Compile); var attribute = new TestGitHubActionsAttribute(GitHubActionsImage.UbuntuLatest) { On = new[] { GitHubActionsTrigger.Push }, - InvokedTargets = new[] { nameof(ConfigurationGenerationTest.TestBuild.Test) }, + InvokedTargets = new[] { nameof(ConfigurationGenerationSpecs.TestBuild.Test) }, Env = env }; ((ConfigurationAttributeBase)attribute).Build = build; diff --git a/tests/Fallout.Common.Specs/CI/GitHubActionsRunsOnLabelsValidationSpecs.cs b/tests/Fallout.Common.Specs/CI/GitHubActionsRunsOnLabelsValidationSpecs.cs new file mode 100644 index 000000000..3c73b6100 --- /dev/null +++ b/tests/Fallout.Common.Specs/CI/GitHubActionsRunsOnLabelsValidationSpecs.cs @@ -0,0 +1,78 @@ +using System; +using Fallout.Common.CI; +using Fallout.Common.CI.GitHubActions; +using Fallout.Common.Execution; +using FluentAssertions; +using Xunit; + +namespace Fallout.Common.Specs.CI; + +public class GitHubActionsRunsOnLabelsValidationSpecs +{ + [Fact] + public void Matrix_with_runs_on_labels_throws() + { + var act = () => GetConfiguration( + new[] { GitHubActionsImage.UbuntuLatest, GitHubActionsImage.WindowsLatest }, + new[] { "self-hosted", "linux", "x64" }); + + act.Should().Throw().WithMessage("*RunsOnLabels*"); + } + + [Fact] + public void Single_image_with_runs_on_labels_does_not_throw() + { + var act = () => GetConfiguration( + new[] { GitHubActionsImage.UbuntuLatest }, + new[] { "self-hosted", "linux", "x64" }); + + act.Should().NotThrow(); + } + + [Fact] + public void Matrix_without_runs_on_labels_does_not_throw() + { + var act = () => GetConfiguration( + new[] { GitHubActionsImage.UbuntuLatest, GitHubActionsImage.WindowsLatest }, + new string[0]); + + act.Should().NotThrow(); + } + + [Fact] + public void Single_label_does_not_throw() + { + var act = () => GetConfiguration( + new[] { GitHubActionsImage.UbuntuLatest }, + new[] { "self-hosted" }); + + act.Should().NotThrow(); + } + + [Theory] + [InlineData(null)] + [InlineData("")] + [InlineData(" ")] + public void Empty_or_whitespace_label_element_throws(string badLabel) + { + var act = () => GetConfiguration( + new[] { GitHubActionsImage.UbuntuLatest }, + new[] { "self-hosted", badLabel }); + + act.Should().Throw().WithMessage("*RunsOnLabels*"); + } + + private static void GetConfiguration(GitHubActionsImage[] images, string[] runsOnLabels) + { + var build = new ConfigurationGenerationSpecs.TestBuild(); + var relevantTargets = ExecutableTargetFactory.CreateAll(build, x => x.Compile); + var attribute = new TestGitHubActionsAttribute(images[0], images[1..]) + { + On = new[] { GitHubActionsTrigger.Push }, + InvokedTargets = new[] { nameof(ConfigurationGenerationSpecs.TestBuild.Test) }, + RunsOnLabels = runsOnLabels + }; + ((ConfigurationAttributeBase)attribute).Build = build; + attribute.GetConfiguration(relevantTargets); + } +} diff --git a/tests/Fallout.Common.Tests/CI/ITestConfigurationGenerator.cs b/tests/Fallout.Common.Specs/CI/ISpecConfigurationGenerator.cs similarity index 84% rename from tests/Fallout.Common.Tests/CI/ITestConfigurationGenerator.cs rename to tests/Fallout.Common.Specs/CI/ISpecConfigurationGenerator.cs index 547000106..3663db91a 100644 --- a/tests/Fallout.Common.Tests/CI/ITestConfigurationGenerator.cs +++ b/tests/Fallout.Common.Specs/CI/ISpecConfigurationGenerator.cs @@ -3,7 +3,7 @@ using System.Linq; using Fallout.Common.CI; -namespace Fallout.Common.Tests.CI; +namespace Fallout.Common.Specs.CI; public interface ITestConfigurationGenerator : IConfigurationGenerator { diff --git a/tests/Fallout.Common.Tests/CI/TestAppVeyorAttribute.cs b/tests/Fallout.Common.Specs/CI/SpecAppVeyorAttribute.cs similarity index 92% rename from tests/Fallout.Common.Tests/CI/TestAppVeyorAttribute.cs rename to tests/Fallout.Common.Specs/CI/SpecAppVeyorAttribute.cs index 4f85207a9..ea9e16d19 100644 --- a/tests/Fallout.Common.Tests/CI/TestAppVeyorAttribute.cs +++ b/tests/Fallout.Common.Specs/CI/SpecAppVeyorAttribute.cs @@ -3,7 +3,7 @@ using System.Linq; using Fallout.Common.CI.AppVeyor; -namespace Fallout.Common.Tests.CI; +namespace Fallout.Common.Specs.CI; public class TestAppVeyorAttribute : AppVeyorAttribute, ITestConfigurationGenerator { diff --git a/tests/Fallout.Common.Tests/CI/TestAzurePipelinesAttribute.cs b/tests/Fallout.Common.Specs/CI/SpecAzurePipelinesAttribute.cs similarity index 93% rename from tests/Fallout.Common.Tests/CI/TestAzurePipelinesAttribute.cs rename to tests/Fallout.Common.Specs/CI/SpecAzurePipelinesAttribute.cs index be6589670..45829980c 100644 --- a/tests/Fallout.Common.Tests/CI/TestAzurePipelinesAttribute.cs +++ b/tests/Fallout.Common.Specs/CI/SpecAzurePipelinesAttribute.cs @@ -3,7 +3,7 @@ using System.Linq; using Fallout.Common.CI.AzurePipelines; -namespace Fallout.Common.Tests.CI; +namespace Fallout.Common.Specs.CI; public class TestAzurePipelinesAttribute : AzurePipelinesAttribute, ITestConfigurationGenerator { diff --git a/tests/Fallout.Common.Tests/CI/TestGitHubActionsAttribute.cs b/tests/Fallout.Common.Specs/CI/SpecGitHubActionsAttribute.cs similarity index 93% rename from tests/Fallout.Common.Tests/CI/TestGitHubActionsAttribute.cs rename to tests/Fallout.Common.Specs/CI/SpecGitHubActionsAttribute.cs index b699aa89f..3f8c633bc 100644 --- a/tests/Fallout.Common.Tests/CI/TestGitHubActionsAttribute.cs +++ b/tests/Fallout.Common.Specs/CI/SpecGitHubActionsAttribute.cs @@ -3,7 +3,7 @@ using System.Linq; using Fallout.Common.CI.GitHubActions; -namespace Fallout.Common.Tests.CI; +namespace Fallout.Common.Specs.CI; public class TestGitHubActionsAttribute : GitHubActionsAttribute, ITestConfigurationGenerator { diff --git a/tests/Fallout.Common.Tests/CI/TestSpaceAutomationAttribute.cs b/tests/Fallout.Common.Specs/CI/SpecSpaceAutomationAttribute.cs similarity index 89% rename from tests/Fallout.Common.Tests/CI/TestSpaceAutomationAttribute.cs rename to tests/Fallout.Common.Specs/CI/SpecSpaceAutomationAttribute.cs index 6b76fac5b..497526893 100644 --- a/tests/Fallout.Common.Tests/CI/TestSpaceAutomationAttribute.cs +++ b/tests/Fallout.Common.Specs/CI/SpecSpaceAutomationAttribute.cs @@ -1,9 +1,9 @@ -using System; +using System; using System.IO; using System.Linq; using Fallout.Common.CI.SpaceAutomation; -namespace Fallout.Common.Tests.CI; +namespace Fallout.Common.Specs.CI; public class TestSpaceAutomationAttribute : SpaceAutomationAttribute, ITestConfigurationGenerator { diff --git a/tests/Fallout.Common.Tests/CI/TestTeamCityAttribute.cs b/tests/Fallout.Common.Specs/CI/SpecTeamCityAttribute.cs similarity index 89% rename from tests/Fallout.Common.Tests/CI/TestTeamCityAttribute.cs rename to tests/Fallout.Common.Specs/CI/SpecTeamCityAttribute.cs index ea166fec0..f8d7e11f5 100644 --- a/tests/Fallout.Common.Tests/CI/TestTeamCityAttribute.cs +++ b/tests/Fallout.Common.Specs/CI/SpecTeamCityAttribute.cs @@ -3,7 +3,7 @@ using System.Linq; using Fallout.Common.CI.TeamCity; -namespace Fallout.Common.Tests.CI; +namespace Fallout.Common.Specs.CI; public class TestTeamCityAttribute : TeamCityAttribute, ITestConfigurationGenerator { diff --git a/tests/Fallout.Common.Tests/CITest.cs b/tests/Fallout.Common.Specs/CISpecs.cs similarity index 98% rename from tests/Fallout.Common.Tests/CITest.cs rename to tests/Fallout.Common.Specs/CISpecs.cs index ac1a79ab3..81d76213e 100644 --- a/tests/Fallout.Common.Tests/CITest.cs +++ b/tests/Fallout.Common.Specs/CISpecs.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Globalization; using System.Linq; @@ -14,9 +14,9 @@ using Fallout.Common.CI.TravisCI; using Xunit; -namespace Fallout.Common.Tests; +namespace Fallout.Common.Specs; -public class CITest +public class CISpecs { [CITheory(typeof(AppVeyor))] [MemberData(nameof(Properties), typeof(AppVeyor))] diff --git a/tests/Fallout.Common.Tests/ChangelogReferenceFiles/changelog_reference_1.0.0_variant_1.md b/tests/Fallout.Common.Specs/ChangelogReferenceFiles/changelog_reference_1.0.0_variant_1.md similarity index 100% rename from tests/Fallout.Common.Tests/ChangelogReferenceFiles/changelog_reference_1.0.0_variant_1.md rename to tests/Fallout.Common.Specs/ChangelogReferenceFiles/changelog_reference_1.0.0_variant_1.md diff --git a/tests/Fallout.Common.Tests/ChangelogReferenceFiles/changelog_reference_1.0.0_variant_1.verified.txt b/tests/Fallout.Common.Specs/ChangelogReferenceFiles/changelog_reference_1.0.0_variant_1.verified.txt similarity index 100% rename from tests/Fallout.Common.Tests/ChangelogReferenceFiles/changelog_reference_1.0.0_variant_1.verified.txt rename to tests/Fallout.Common.Specs/ChangelogReferenceFiles/changelog_reference_1.0.0_variant_1.verified.txt diff --git a/tests/Fallout.Common.Tests/ChangelogReferenceFiles/changelog_reference_1.0.0_variant_2.md b/tests/Fallout.Common.Specs/ChangelogReferenceFiles/changelog_reference_1.0.0_variant_2.md similarity index 100% rename from tests/Fallout.Common.Tests/ChangelogReferenceFiles/changelog_reference_1.0.0_variant_2.md rename to tests/Fallout.Common.Specs/ChangelogReferenceFiles/changelog_reference_1.0.0_variant_2.md diff --git a/tests/Fallout.Common.Tests/ChangelogReferenceFiles/changelog_reference_1.0.0_variant_2.verified.txt b/tests/Fallout.Common.Specs/ChangelogReferenceFiles/changelog_reference_1.0.0_variant_2.verified.txt similarity index 100% rename from tests/Fallout.Common.Tests/ChangelogReferenceFiles/changelog_reference_1.0.0_variant_2.verified.txt rename to tests/Fallout.Common.Specs/ChangelogReferenceFiles/changelog_reference_1.0.0_variant_2.verified.txt diff --git a/tests/Fallout.Common.Tests/ChangelogReferenceFiles/changelog_reference_1.0.0_variant_3.md b/tests/Fallout.Common.Specs/ChangelogReferenceFiles/changelog_reference_1.0.0_variant_3.md similarity index 100% rename from tests/Fallout.Common.Tests/ChangelogReferenceFiles/changelog_reference_1.0.0_variant_3.md rename to tests/Fallout.Common.Specs/ChangelogReferenceFiles/changelog_reference_1.0.0_variant_3.md diff --git a/tests/Fallout.Common.Tests/ChangelogReferenceFiles/changelog_reference_1.0.0_variant_3.verified.txt b/tests/Fallout.Common.Specs/ChangelogReferenceFiles/changelog_reference_1.0.0_variant_3.verified.txt similarity index 100% rename from tests/Fallout.Common.Tests/ChangelogReferenceFiles/changelog_reference_1.0.0_variant_3.verified.txt rename to tests/Fallout.Common.Specs/ChangelogReferenceFiles/changelog_reference_1.0.0_variant_3.verified.txt diff --git a/tests/Fallout.Common.Tests/ChangelogReferenceFiles/changelog_reference_1.0.0_variant_4.md b/tests/Fallout.Common.Specs/ChangelogReferenceFiles/changelog_reference_1.0.0_variant_4.md similarity index 100% rename from tests/Fallout.Common.Tests/ChangelogReferenceFiles/changelog_reference_1.0.0_variant_4.md rename to tests/Fallout.Common.Specs/ChangelogReferenceFiles/changelog_reference_1.0.0_variant_4.md diff --git a/tests/Fallout.Common.Tests/ChangelogReferenceFiles/changelog_reference_1.0.0_variant_4.verified.txt b/tests/Fallout.Common.Specs/ChangelogReferenceFiles/changelog_reference_1.0.0_variant_4.verified.txt similarity index 100% rename from tests/Fallout.Common.Tests/ChangelogReferenceFiles/changelog_reference_1.0.0_variant_4.verified.txt rename to tests/Fallout.Common.Specs/ChangelogReferenceFiles/changelog_reference_1.0.0_variant_4.verified.txt diff --git a/tests/Fallout.Common.Tests/ChangelogReferenceFiles/changelog_reference_1.0.0_variant_5.md b/tests/Fallout.Common.Specs/ChangelogReferenceFiles/changelog_reference_1.0.0_variant_5.md similarity index 100% rename from tests/Fallout.Common.Tests/ChangelogReferenceFiles/changelog_reference_1.0.0_variant_5.md rename to tests/Fallout.Common.Specs/ChangelogReferenceFiles/changelog_reference_1.0.0_variant_5.md diff --git a/tests/Fallout.Common.Tests/ChangelogReferenceFiles/changelog_reference_1.0.0_variant_5.verified.txt b/tests/Fallout.Common.Specs/ChangelogReferenceFiles/changelog_reference_1.0.0_variant_5.verified.txt similarity index 100% rename from tests/Fallout.Common.Tests/ChangelogReferenceFiles/changelog_reference_1.0.0_variant_5.verified.txt rename to tests/Fallout.Common.Specs/ChangelogReferenceFiles/changelog_reference_1.0.0_variant_5.verified.txt diff --git a/tests/Fallout.Common.Tests/ChangelogReferenceFiles/changelog_reference_1.0.0_variant_5_section_0.2.3.verified.txt b/tests/Fallout.Common.Specs/ChangelogReferenceFiles/changelog_reference_1.0.0_variant_5_section_0.2.3.verified.txt similarity index 100% rename from tests/Fallout.Common.Tests/ChangelogReferenceFiles/changelog_reference_1.0.0_variant_5_section_0.2.3.verified.txt rename to tests/Fallout.Common.Specs/ChangelogReferenceFiles/changelog_reference_1.0.0_variant_5_section_0.2.3.verified.txt diff --git a/tests/Fallout.Common.Tests/ChangelogReferenceFiles/changelog_reference_NUKE_variant_1.md b/tests/Fallout.Common.Specs/ChangelogReferenceFiles/changelog_reference_NUKE_variant_1.md similarity index 100% rename from tests/Fallout.Common.Tests/ChangelogReferenceFiles/changelog_reference_NUKE_variant_1.md rename to tests/Fallout.Common.Specs/ChangelogReferenceFiles/changelog_reference_NUKE_variant_1.md diff --git a/tests/Fallout.Common.Tests/ChangelogReferenceFiles/changelog_reference_NUKE_variant_1.verified.txt b/tests/Fallout.Common.Specs/ChangelogReferenceFiles/changelog_reference_NUKE_variant_1.verified.txt similarity index 100% rename from tests/Fallout.Common.Tests/ChangelogReferenceFiles/changelog_reference_NUKE_variant_1.verified.txt rename to tests/Fallout.Common.Specs/ChangelogReferenceFiles/changelog_reference_NUKE_variant_1.verified.txt diff --git a/tests/Fallout.Common.Tests/ChangelogReferenceFiles/changelog_reference_NUKE_variant_2.md b/tests/Fallout.Common.Specs/ChangelogReferenceFiles/changelog_reference_NUKE_variant_2.md similarity index 100% rename from tests/Fallout.Common.Tests/ChangelogReferenceFiles/changelog_reference_NUKE_variant_2.md rename to tests/Fallout.Common.Specs/ChangelogReferenceFiles/changelog_reference_NUKE_variant_2.md diff --git a/tests/Fallout.Common.Tests/ChangelogReferenceFiles/changelog_reference_NUKE_variant_2.verified.txt b/tests/Fallout.Common.Specs/ChangelogReferenceFiles/changelog_reference_NUKE_variant_2.verified.txt similarity index 100% rename from tests/Fallout.Common.Tests/ChangelogReferenceFiles/changelog_reference_NUKE_variant_2.verified.txt rename to tests/Fallout.Common.Specs/ChangelogReferenceFiles/changelog_reference_NUKE_variant_2.verified.txt diff --git a/tests/Fallout.Common.Tests/ChangelogReferenceFiles/changelog_reference_invalid_variant_1.md b/tests/Fallout.Common.Specs/ChangelogReferenceFiles/changelog_reference_invalid_variant_1.md similarity index 100% rename from tests/Fallout.Common.Tests/ChangelogReferenceFiles/changelog_reference_invalid_variant_1.md rename to tests/Fallout.Common.Specs/ChangelogReferenceFiles/changelog_reference_invalid_variant_1.md diff --git a/tests/Fallout.Common.Tests/ChangelogReferenceFiles/changelog_reference_invalid_variant_2.md b/tests/Fallout.Common.Specs/ChangelogReferenceFiles/changelog_reference_invalid_variant_2.md similarity index 100% rename from tests/Fallout.Common.Tests/ChangelogReferenceFiles/changelog_reference_invalid_variant_2.md rename to tests/Fallout.Common.Specs/ChangelogReferenceFiles/changelog_reference_invalid_variant_2.md diff --git a/tests/Fallout.Common.Tests/ChangelogTasksTest.cs b/tests/Fallout.Common.Specs/ChangelogTasksSpecs.cs similarity index 85% rename from tests/Fallout.Common.Tests/ChangelogTasksTest.cs rename to tests/Fallout.Common.Specs/ChangelogTasksSpecs.cs index f7f639681..d7ed76852 100644 --- a/tests/Fallout.Common.Tests/ChangelogTasksTest.cs +++ b/tests/Fallout.Common.Specs/ChangelogTasksSpecs.cs @@ -1,22 +1,24 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using FluentAssertions; using Fallout.Common.ChangeLog; +using Fallout.Common.Git; using Fallout.Common.IO; +using Fallout.Common.Tools.GitHub; using VerifyXunit; using Xunit; // ReSharper disable ReturnValueOfPureMethodIsNotUsed -namespace Fallout.Common.Tests; +namespace Fallout.Common.Specs; -public class ChangelogTasksTest +public class ChangelogTasksSpecs { private static AbsolutePath RootDirectory => Constants.TryGetRootDirectoryFrom(EnvironmentInfo.WorkingDirectory).NotNull(); - private static AbsolutePath PathToChangelogReferenceFiles => RootDirectory / "tests" / "Fallout.Common.Tests" / "ChangelogReferenceFiles"; + private static AbsolutePath PathToChangelogReferenceFiles => RootDirectory / "tests" / "Fallout.Common.Specs" / "ChangelogReferenceFiles"; [Theory] [MemberData(nameof(AllChangelogReference_1_0_0_Files))] @@ -38,6 +40,20 @@ public void Extracting_a_changelog_from_a_non_existing_file_returns_an_empty_col ChangelogTasks.ExtractChangelogSectionNotes(file).Should().BeEmpty(); } + [Fact] + public void Missing_changelog_does_not_add_a_full_changelog_link_to_release_notes() + { + // Arrange + var changelogFile = RootDirectory / "does-not-exist.md"; + var repository = GitRepository.FromLocalDirectory(RootDirectory); + + // Act + string releaseNotes = ChangelogTasks.GetNuGetReleaseNotes(changelogFile, repository); + + // Assert + releaseNotes.Should().BeEmpty(); + } + [Fact] public void GetReleaseSections_ChangelogReferenceFileWithoutReleaseHead_ReturnsEmpty() { diff --git a/tests/Fallout.Common.Tests/Fallout.Common.Tests.csproj b/tests/Fallout.Common.Specs/Fallout.Common.Specs.csproj similarity index 100% rename from tests/Fallout.Common.Tests/Fallout.Common.Tests.csproj rename to tests/Fallout.Common.Specs/Fallout.Common.Specs.csproj diff --git a/tests/Fallout.Common.Tests/GitHubTasksTest.cs b/tests/Fallout.Common.Specs/GitHubTasksSpecs.cs similarity index 92% rename from tests/Fallout.Common.Tests/GitHubTasksTest.cs rename to tests/Fallout.Common.Specs/GitHubTasksSpecs.cs index 1b13ea081..ce632b0e3 100644 --- a/tests/Fallout.Common.Tests/GitHubTasksTest.cs +++ b/tests/Fallout.Common.Specs/GitHubTasksSpecs.cs @@ -6,14 +6,14 @@ using Fallout.Common.Tools.GitHub; using Xunit; -namespace Fallout.Common.Tests; +namespace Fallout.Common.Specs; -public class GitHubTasksTest +public class GitHubTasksSpecs { private static AbsolutePath RootDirectory => Constants.TryGetRootDirectoryFrom(EnvironmentInfo.WorkingDirectory).NotNull(); [Fact] - public void GitHubRepositoryFromLocalDirectoryTest() + public void GitHubRepositoryFromLocalDirectorySpec() { var repository = GitRepository.FromLocalDirectory(RootDirectory).NotNull(); if (!repository.IsGitHubRepository()) @@ -39,7 +39,7 @@ public void GitHubRepositoryFromLocalDirectoryTest() } [Fact] - public void GitHubRepositoryFromUrlTest() + public void GitHubRepositoryFromUrlSpec() { var repository = GitRepository.FromUrl("https://github.com/nuke-build/nuke", "dev"); diff --git a/tests/Fallout.Common.Tests/GitVersionParseTest.cs b/tests/Fallout.Common.Specs/GitVersionParseSpecs.cs similarity index 97% rename from tests/Fallout.Common.Tests/GitVersionParseTest.cs rename to tests/Fallout.Common.Specs/GitVersionParseSpecs.cs index daf16c51d..f7d68756d 100644 --- a/tests/Fallout.Common.Tests/GitVersionParseTest.cs +++ b/tests/Fallout.Common.Specs/GitVersionParseSpecs.cs @@ -8,13 +8,13 @@ using Fallout.Common.Utilities; using Xunit; -namespace Fallout.Common.Tests; +namespace Fallout.Common.Specs; /// /// Regression tests for GitVersion JSON deserialisation (issue #218). /// GitVersion 6.x emits several fields as bare JSON numbers instead of quoted strings. /// -public class GitVersionParseTest +public class GitVersionParseSpecs { // Exact payload from issue #218 — BuildMetaData, CommitsSinceVersionSource, // PreReleaseNumber and WeightedPreReleaseNumber are numbers, not strings. diff --git a/tests/Fallout.Common.Tests/SettingsTest.TestDiscord.verified.txt b/tests/Fallout.Common.Specs/SettingsSpecs.TestDiscord.verified.txt similarity index 100% rename from tests/Fallout.Common.Tests/SettingsTest.TestDiscord.verified.txt rename to tests/Fallout.Common.Specs/SettingsSpecs.TestDiscord.verified.txt diff --git a/tests/Fallout.Common.Tests/SettingsTest.cs b/tests/Fallout.Common.Specs/SettingsSpecs.cs similarity index 99% rename from tests/Fallout.Common.Tests/SettingsTest.cs rename to tests/Fallout.Common.Specs/SettingsSpecs.cs index 1bdff94ab..a6dd051a0 100644 --- a/tests/Fallout.Common.Tests/SettingsTest.cs +++ b/tests/Fallout.Common.Specs/SettingsSpecs.cs @@ -18,9 +18,9 @@ using VerifyXunit; using Xunit; -namespace Fallout.Common.Tests; +namespace Fallout.Common.Specs; -public class SettingsTest +public class SettingsSpecs { private static AbsolutePath RootDirectory => Constants.TryGetRootDirectoryFrom(Directory.GetCurrentDirectory()).NotNull(); diff --git a/tests/Fallout.Common.Tests/VerifyTestsInitializer.cs b/tests/Fallout.Common.Specs/VerifySpecsInitializer.cs similarity index 88% rename from tests/Fallout.Common.Tests/VerifyTestsInitializer.cs rename to tests/Fallout.Common.Specs/VerifySpecsInitializer.cs index 661d4b232..ff5f8c9a5 100644 --- a/tests/Fallout.Common.Tests/VerifyTestsInitializer.cs +++ b/tests/Fallout.Common.Specs/VerifySpecsInitializer.cs @@ -1,9 +1,9 @@ -using System; +using System; using System.Linq; using System.Runtime.CompilerServices; using VerifyTests; -namespace Fallout.Common.Tests; +namespace Fallout.Common.Specs; public static class VerifyTestsInitializer { diff --git a/tests/Fallout.Components.Tests/Fallout.Components.Tests.csproj b/tests/Fallout.Components.Specs/Fallout.Components.Specs.csproj similarity index 100% rename from tests/Fallout.Components.Tests/Fallout.Components.Tests.csproj rename to tests/Fallout.Components.Specs/Fallout.Components.Specs.csproj diff --git a/tests/Fallout.Components.Tests/PublishPackageRouterTests.cs b/tests/Fallout.Components.Specs/PublishPackageRouterSpecs.cs similarity index 96% rename from tests/Fallout.Components.Tests/PublishPackageRouterTests.cs rename to tests/Fallout.Components.Specs/PublishPackageRouterSpecs.cs index 1c4f81ff1..b2404144a 100644 --- a/tests/Fallout.Components.Tests/PublishPackageRouterTests.cs +++ b/tests/Fallout.Components.Specs/PublishPackageRouterSpecs.cs @@ -1,9 +1,9 @@ using FluentAssertions; using Xunit; -namespace Fallout.Components.Tests; +namespace Fallout.Components.Specs; -public class PublishPackageRouterTests +public class PublishPackageRouterSpecs { [Theory] [InlineData("Fallout.*", "Fallout.Common.2026.1.0", true)] diff --git a/tests/Fallout.Core.Tests/ArchitectureFitnessTests.cs b/tests/Fallout.Core.Specs/ArchitectureFitnessSpecs.cs similarity index 97% rename from tests/Fallout.Core.Tests/ArchitectureFitnessTests.cs rename to tests/Fallout.Core.Specs/ArchitectureFitnessSpecs.cs index d4aed0960..0c00c7f8f 100644 --- a/tests/Fallout.Core.Tests/ArchitectureFitnessTests.cs +++ b/tests/Fallout.Core.Specs/ArchitectureFitnessSpecs.cs @@ -5,14 +5,14 @@ using NetArchTest.Rules; using Xunit; -namespace Fallout.Core.Tests; +namespace Fallout.Core.Specs; /// /// The acceptance criterion for issue #88: Fallout.Core is the pure reactor core. It depends on /// nothing in the repo and never touches I/O, processes, the console, or logging. The broader /// architecture-fitness suite lands in #95; these two tests guard the Core invariant specifically. /// -public class ArchitectureFitnessTests +public class ArchitectureFitnessSpecs { private static readonly Assembly CoreAssembly = typeof(TopoSort).Assembly; diff --git a/tests/Fallout.Core.Tests/Fallout.Core.Tests.csproj b/tests/Fallout.Core.Specs/Fallout.Core.Specs.csproj similarity index 100% rename from tests/Fallout.Core.Tests/Fallout.Core.Tests.csproj rename to tests/Fallout.Core.Specs/Fallout.Core.Specs.csproj diff --git a/tests/Fallout.Core.Tests/TopoSortTests.cs b/tests/Fallout.Core.Specs/TopoSortSpecs.cs similarity index 97% rename from tests/Fallout.Core.Tests/TopoSortTests.cs rename to tests/Fallout.Core.Specs/TopoSortSpecs.cs index bbc93cd96..272f1936f 100644 --- a/tests/Fallout.Core.Tests/TopoSortTests.cs +++ b/tests/Fallout.Core.Specs/TopoSortSpecs.cs @@ -4,9 +4,9 @@ using Fallout.Core.Planning; using Xunit; -namespace Fallout.Core.Tests; +namespace Fallout.Core.Specs; -public class TopoSortTests +public class TopoSortSpecs { // Edges read as "depends on". Anything not listed has no dependencies. private static PlanResult Order( diff --git a/tests/Fallout.Migrate.Analyzers.Tests/AnalyzerTestHarness.cs b/tests/Fallout.Migrate.Analyzers.Specs/AnalyzerSpecHarness.cs similarity index 80% rename from tests/Fallout.Migrate.Analyzers.Tests/AnalyzerTestHarness.cs rename to tests/Fallout.Migrate.Analyzers.Specs/AnalyzerSpecHarness.cs index a91a0b964..37220bbba 100644 --- a/tests/Fallout.Migrate.Analyzers.Tests/AnalyzerTestHarness.cs +++ b/tests/Fallout.Migrate.Analyzers.Specs/AnalyzerSpecHarness.cs @@ -3,7 +3,7 @@ using Microsoft.CodeAnalysis.CSharp.Testing; using Microsoft.CodeAnalysis.Testing; -namespace Fallout.Migrate.Analyzers.Tests; +namespace Fallout.Migrate.Analyzers.Specs; // Convenience aliases so the test bodies stay focused on what they assert, // not on plumbing. @@ -23,17 +23,17 @@ internal static class AnalyzerTestHarness MetadataReference.CreateFromFile(typeof(global::Fallout.Common.Utilities.CompletionUtility).Assembly.Location); } -internal sealed class AnalyzerTest : CSharpAnalyzerTest +internal sealed class AnalyzerSpecs : CSharpAnalyzerTest { - public AnalyzerTest() + public AnalyzerSpecs() { TestState.AdditionalReferences.Add(AnalyzerTestHarness.FalloutMarkerReference); } } -internal sealed class CodeFixTest : CSharpCodeFixTest +internal sealed class CodeFixSpecs : CSharpCodeFixTest { - public CodeFixTest() + public CodeFixSpecs() { TestState.AdditionalReferences.Add(AnalyzerTestHarness.FalloutMarkerReference); FixedState.AdditionalReferences.Add(AnalyzerTestHarness.FalloutMarkerReference); diff --git a/tests/Fallout.Migrate.Analyzers.Tests/Fallout.Migrate.Analyzers.Tests.csproj b/tests/Fallout.Migrate.Analyzers.Specs/Fallout.Migrate.Analyzers.Specs.csproj similarity index 100% rename from tests/Fallout.Migrate.Analyzers.Tests/Fallout.Migrate.Analyzers.Tests.csproj rename to tests/Fallout.Migrate.Analyzers.Specs/Fallout.Migrate.Analyzers.Specs.csproj diff --git a/tests/Fallout.Migrate.Analyzers.Tests/NukeMigrationAnalyzerTests.cs b/tests/Fallout.Migrate.Analyzers.Specs/NukeMigrationAnalyzerSpecs.cs similarity index 86% rename from tests/Fallout.Migrate.Analyzers.Tests/NukeMigrationAnalyzerTests.cs rename to tests/Fallout.Migrate.Analyzers.Specs/NukeMigrationAnalyzerSpecs.cs index f2053e835..f28985ca8 100644 --- a/tests/Fallout.Migrate.Analyzers.Tests/NukeMigrationAnalyzerTests.cs +++ b/tests/Fallout.Migrate.Analyzers.Specs/NukeMigrationAnalyzerSpecs.cs @@ -1,9 +1,9 @@ using System.Threading.Tasks; using Xunit; -namespace Fallout.Migrate.Analyzers.Tests; +namespace Fallout.Migrate.Analyzers.Specs; -public class NukeMigrationAnalyzerTests +public class NukeMigrationAnalyzerSpecs { // Stubs so the test compilations actually resolve the legacy Nuke.* names. // Without these the compiler emits CS0246 alongside FALLOUT004 and the @@ -28,7 +28,7 @@ namespace X { class C { } } {{LegacyNukeStub}} """; - await new AnalyzerTest { TestCode = source }.RunAsync(); + await new AnalyzerSpecs { TestCode = source }.RunAsync(); } [Fact] @@ -40,7 +40,7 @@ namespace X { class C { } } {{LegacyNukeStub}} """; - await new AnalyzerTest { TestCode = source }.RunAsync(); + await new AnalyzerSpecs { TestCode = source }.RunAsync(); } [Fact] @@ -60,7 +60,7 @@ void M() {{LegacyNukeStub}} """; - await new AnalyzerTest { TestCode = source }.RunAsync(); + await new AnalyzerSpecs { TestCode = source }.RunAsync(); } [Fact] @@ -74,7 +74,7 @@ class NukeBuild { } } """; - await new AnalyzerTest { TestCode = source }.RunAsync(); + await new AnalyzerSpecs { TestCode = source }.RunAsync(); } [Fact] @@ -88,7 +88,7 @@ interface INukeBuild { } } """; - await new AnalyzerTest { TestCode = source }.RunAsync(); + await new AnalyzerSpecs { TestCode = source }.RunAsync(); } [Fact] @@ -128,6 +128,6 @@ void M() } """; - await new AnalyzerTest { TestCode = source }.RunAsync(); + await new AnalyzerSpecs { TestCode = source }.RunAsync(); } } diff --git a/tests/Fallout.Migrate.Analyzers.Tests/NukeMigrationCodeFixTests.cs b/tests/Fallout.Migrate.Analyzers.Specs/NukeMigrationCodeFixSpecs.cs similarity index 87% rename from tests/Fallout.Migrate.Analyzers.Tests/NukeMigrationCodeFixTests.cs rename to tests/Fallout.Migrate.Analyzers.Specs/NukeMigrationCodeFixSpecs.cs index 7f652bc92..a9017bce1 100644 --- a/tests/Fallout.Migrate.Analyzers.Tests/NukeMigrationCodeFixTests.cs +++ b/tests/Fallout.Migrate.Analyzers.Specs/NukeMigrationCodeFixSpecs.cs @@ -1,9 +1,9 @@ using System.Threading.Tasks; using Xunit; -namespace Fallout.Migrate.Analyzers.Tests; +namespace Fallout.Migrate.Analyzers.Specs; -public class NukeMigrationCodeFixTests +public class NukeMigrationCodeFixSpecs { // Both legacy and target namespaces need to exist in the test compilation — // legacy for the pre-fix source, target for the fixed source — otherwise the @@ -47,7 +47,7 @@ namespace X { class C { } } {{TargetFalloutStub}} """; - await new CodeFixTest { TestCode = source, FixedCode = fixedSource }.RunAsync(); + await new CodeFixSpecs { TestCode = source, FixedCode = fixedSource }.RunAsync(); } [Fact] @@ -67,7 +67,7 @@ namespace X { class C { } } {{TargetFalloutStub}} """; - await new CodeFixTest { TestCode = source, FixedCode = fixedSource }.RunAsync(); + await new CodeFixSpecs { TestCode = source, FixedCode = fixedSource }.RunAsync(); } [Fact] @@ -97,7 +97,7 @@ class C {{TargetFalloutStub}} """; - await new CodeFixTest { TestCode = source, FixedCode = fixedSource }.RunAsync(); + await new CodeFixSpecs { TestCode = source, FixedCode = fixedSource }.RunAsync(); } [Fact] @@ -121,7 +121,7 @@ class FalloutBuild { } } """; - await new CodeFixTest { TestCode = source, FixedCode = fixedSource }.RunAsync(); + await new CodeFixSpecs { TestCode = source, FixedCode = fixedSource }.RunAsync(); } [Fact] @@ -145,7 +145,7 @@ interface IFalloutBuild { } } """; - await new CodeFixTest { TestCode = source, FixedCode = fixedSource }.RunAsync(); + await new CodeFixSpecs { TestCode = source, FixedCode = fixedSource }.RunAsync(); } [Fact] @@ -167,6 +167,6 @@ namespace X { class C { } } {{TargetFalloutStub}} """; - await new CodeFixTest { TestCode = source, FixedCode = fixedSource }.RunAsync(); + await new CodeFixSpecs { TestCode = source, FixedCode = fixedSource }.RunAsync(); } } diff --git a/tests/Fallout.Migrate.Analyzers.Tests/RealWorldSmokeTests.cs b/tests/Fallout.Migrate.Analyzers.Specs/RealWorldSmokeSpecs.cs similarity index 94% rename from tests/Fallout.Migrate.Analyzers.Tests/RealWorldSmokeTests.cs rename to tests/Fallout.Migrate.Analyzers.Specs/RealWorldSmokeSpecs.cs index 3854bc72f..2f2b1522c 100644 --- a/tests/Fallout.Migrate.Analyzers.Tests/RealWorldSmokeTests.cs +++ b/tests/Fallout.Migrate.Analyzers.Specs/RealWorldSmokeSpecs.cs @@ -1,14 +1,14 @@ using System.Threading.Tasks; using Xunit; -namespace Fallout.Migrate.Analyzers.Tests; +namespace Fallout.Migrate.Analyzers.Specs; // End-to-end smoke test: the snippet below is distilled from a real pre-rename // version of this repo's own build/Build.cs (commit 6967a094^, before #54 // renamed Nuke.* → Fallout.*). Exercises the analyzer + codefix on the kinds // of patterns an actual NUKE consumer project contains, not just synthetic // minimal cases. If this test breaks, real consumer migrations break too. -public class RealWorldSmokeTests +public class RealWorldSmokeSpecs { // Stand-in declarations so the test compilation can resolve the legacy // Nuke.* namespace structure used in pre-rename consumer code. @@ -77,6 +77,6 @@ partial class Build : FalloutBuild, Fallout.Components.IPack {{TargetFalloutStub}} """; - await new CodeFixTest { TestCode = source, FixedCode = fixedSource }.RunAsync(); + await new CodeFixSpecs { TestCode = source, FixedCode = fixedSource }.RunAsync(); } } diff --git a/tests/Fallout.Migrate.Tests/CodeRewriterTest.cs b/tests/Fallout.Migrate.Specs/CodeRewriterSpecs.cs similarity index 97% rename from tests/Fallout.Migrate.Tests/CodeRewriterTest.cs rename to tests/Fallout.Migrate.Specs/CodeRewriterSpecs.cs index 0047ad28a..1f9f5f2eb 100644 --- a/tests/Fallout.Migrate.Tests/CodeRewriterTest.cs +++ b/tests/Fallout.Migrate.Specs/CodeRewriterSpecs.cs @@ -1,9 +1,9 @@ using FluentAssertions; using Xunit; -namespace Fallout.Migrate.Tests; +namespace Fallout.Migrate.Specs; -public class CodeRewriterTest +public class CodeRewriterSpecs { [Fact] public void RewritesUsingDirective() diff --git a/tests/Fallout.Migrate.Tests/CsprojRewriterTest.cs b/tests/Fallout.Migrate.Specs/CsprojRewriterSpecs.cs similarity index 99% rename from tests/Fallout.Migrate.Tests/CsprojRewriterTest.cs rename to tests/Fallout.Migrate.Specs/CsprojRewriterSpecs.cs index 6e1501768..6db3dca25 100644 --- a/tests/Fallout.Migrate.Tests/CsprojRewriterTest.cs +++ b/tests/Fallout.Migrate.Specs/CsprojRewriterSpecs.cs @@ -1,9 +1,9 @@ using FluentAssertions; using Xunit; -namespace Fallout.Migrate.Tests; +namespace Fallout.Migrate.Specs; -public class CsprojRewriterTest +public class CsprojRewriterSpecs { private const string TestFalloutVersion = "11.0.0"; diff --git a/tests/Fallout.Migrate.Tests/Fallout.Migrate.Tests.csproj b/tests/Fallout.Migrate.Specs/Fallout.Migrate.Specs.csproj similarity index 100% rename from tests/Fallout.Migrate.Tests/Fallout.Migrate.Tests.csproj rename to tests/Fallout.Migrate.Specs/Fallout.Migrate.Specs.csproj diff --git a/tests/Fallout.Migrate.Tests/MigrationIntegrationTest.cs b/tests/Fallout.Migrate.Specs/MigrationIntegrationSpecs.cs similarity index 98% rename from tests/Fallout.Migrate.Tests/MigrationIntegrationTest.cs rename to tests/Fallout.Migrate.Specs/MigrationIntegrationSpecs.cs index 48d4fa153..256193a53 100644 --- a/tests/Fallout.Migrate.Tests/MigrationIntegrationTest.cs +++ b/tests/Fallout.Migrate.Specs/MigrationIntegrationSpecs.cs @@ -5,9 +5,9 @@ using FluentAssertions; using Xunit; -namespace Fallout.Migrate.Tests; +namespace Fallout.Migrate.Specs; -public class MigrationIntegrationTest +public class MigrationIntegrationSpecs { [Fact] public void MigratesVanillaConsumerRepo() diff --git a/tests/Fallout.Migrate.Tests/ScriptRewriterTest.cs b/tests/Fallout.Migrate.Specs/ScriptRewriterSpecs.cs similarity index 95% rename from tests/Fallout.Migrate.Tests/ScriptRewriterTest.cs rename to tests/Fallout.Migrate.Specs/ScriptRewriterSpecs.cs index 98bb64ddc..90b6b461f 100644 --- a/tests/Fallout.Migrate.Tests/ScriptRewriterTest.cs +++ b/tests/Fallout.Migrate.Specs/ScriptRewriterSpecs.cs @@ -1,9 +1,9 @@ using FluentAssertions; using Xunit; -namespace Fallout.Migrate.Tests; +namespace Fallout.Migrate.Specs; -public class ScriptRewriterTest +public class ScriptRewriterSpecs { [Fact] public void RewritesDotnetNukeInvocations() diff --git a/tests/Fallout.ProjectModel.Tests/Fallout.ProjectModel.Tests.csproj b/tests/Fallout.ProjectModel.Specs/Fallout.ProjectModel.Specs.csproj similarity index 100% rename from tests/Fallout.ProjectModel.Tests/Fallout.ProjectModel.Tests.csproj rename to tests/Fallout.ProjectModel.Specs/Fallout.ProjectModel.Specs.csproj diff --git a/tests/Fallout.ProjectModel.Tests/ModuleInit.cs b/tests/Fallout.ProjectModel.Specs/ModuleInit.cs similarity index 96% rename from tests/Fallout.ProjectModel.Tests/ModuleInit.cs rename to tests/Fallout.ProjectModel.Specs/ModuleInit.cs index b0e969fe6..ad0952480 100644 --- a/tests/Fallout.ProjectModel.Tests/ModuleInit.cs +++ b/tests/Fallout.ProjectModel.Specs/ModuleInit.cs @@ -1,7 +1,7 @@ using System.Runtime.CompilerServices; using Fallout.Solutions; -namespace Fallout.Common.Tests; +namespace Fallout.Common.Specs; internal static class ModuleInit { diff --git a/tests/Fallout.ProjectModel.Tests/ProjectModelTest.cs b/tests/Fallout.ProjectModel.Specs/ProjectModelSpecs.cs similarity index 90% rename from tests/Fallout.ProjectModel.Tests/ProjectModelTest.cs rename to tests/Fallout.ProjectModel.Specs/ProjectModelSpecs.cs index a769b2fe0..37c2b26e0 100644 --- a/tests/Fallout.ProjectModel.Tests/ProjectModelTest.cs +++ b/tests/Fallout.ProjectModel.Specs/ProjectModelSpecs.cs @@ -1,20 +1,20 @@ -using System; +using System; using System.Linq; using FluentAssertions; using Fallout.Common.IO; using Fallout.Solutions; using Xunit; -namespace Fallout.Common.Tests; +namespace Fallout.Common.Specs; -public class ProjectModelTest +public class ProjectModelSpecs { private static AbsolutePath RootDirectory => Constants.TryGetRootDirectoryFrom(EnvironmentInfo.WorkingDirectory).NotNull(); private static AbsolutePath SolutionFile => RootDirectory / "fallout.slnx"; [Fact] - public void ProjectTest() + public void ProjectSpec() { var solution = SolutionFile.ReadSolution(); var project = solution.Projects.Single(x => x.Name == "Fallout.ProjectModel"); @@ -29,7 +29,7 @@ public void ProjectTest() } [Fact] - public void MSBuildProjectTest() + public void MSBuildProjectSpec() { var solution = SolutionFile.ReadSolution(); var project = solution.Projects.Single(x => x.Name == "Fallout.ProjectModel"); diff --git a/tests/Fallout.Solution.Tests/Fallout.Solution.Tests.csproj b/tests/Fallout.Solution.Specs/Fallout.Solution.Specs.csproj similarity index 100% rename from tests/Fallout.Solution.Tests/Fallout.Solution.Tests.csproj rename to tests/Fallout.Solution.Specs/Fallout.Solution.Specs.csproj diff --git a/tests/Fallout.Solution.Tests/SolutionTest.cs b/tests/Fallout.Solution.Specs/SolutionSpec.cs similarity index 78% rename from tests/Fallout.Solution.Tests/SolutionTest.cs rename to tests/Fallout.Solution.Specs/SolutionSpec.cs index 8ea2345d5..926f501aa 100644 --- a/tests/Fallout.Solution.Tests/SolutionTest.cs +++ b/tests/Fallout.Solution.Specs/SolutionSpec.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Linq; using FluentAssertions; using Fallout.Common.IO; @@ -6,16 +6,16 @@ using Fallout.Common.Utilities; using Xunit; -namespace Fallout.Common.Tests; +namespace Fallout.Common.Specs; -public class SolutionModelTest +public class SolutionModelSpecs { private static AbsolutePath RootDirectory => Constants.TryGetRootDirectoryFrom(EnvironmentInfo.WorkingDirectory).NotNull(); private static AbsolutePath SolutionFile => RootDirectory / "fallout.slnx"; [Fact] - public void SolutionTest() + public void SolutionSpec() { var solution = SolutionFile.ReadSolution(); @@ -28,10 +28,10 @@ public void SolutionTest() } [Fact] - public void SolutionGetProjectsTest() + public void SolutionGetProjectsSpec() { var solution = SolutionFile.ReadSolution(); - solution.GetAllProjects("*.Tests").Should().HaveCountGreaterThanOrEqualTo(2); + solution.GetAllProjects("*.Specs").Should().HaveCountGreaterThanOrEqualTo(2); } } diff --git a/tests/Fallout.SourceGenerators.Tests/Fallout.SourceGenerators.Tests.csproj b/tests/Fallout.SourceGenerators.Specs/Fallout.SourceGenerators.Specs.csproj similarity index 100% rename from tests/Fallout.SourceGenerators.Tests/Fallout.SourceGenerators.Tests.csproj rename to tests/Fallout.SourceGenerators.Specs/Fallout.SourceGenerators.Specs.csproj diff --git a/tests/Fallout.SourceGenerators.Tests/StronglyTypedSolutionGeneratorTest.Test#Solution.g.verified.cs b/tests/Fallout.SourceGenerators.Specs/StronglyTypedSolutionGeneratorSpecs.Test#Solution.g.verified.cs similarity index 67% rename from tests/Fallout.SourceGenerators.Tests/StronglyTypedSolutionGeneratorTest.Test#Solution.g.verified.cs rename to tests/Fallout.SourceGenerators.Specs/StronglyTypedSolutionGeneratorSpecs.Test#Solution.g.verified.cs index 2dec22605..e93743d4e 100644 --- a/tests/Fallout.SourceGenerators.Tests/StronglyTypedSolutionGeneratorTest.Test#Solution.g.verified.cs +++ b/tests/Fallout.SourceGenerators.Specs/StronglyTypedSolutionGeneratorSpecs.Test#Solution.g.verified.cs @@ -1,4 +1,4 @@ -//HintName: Solution.g.cs +//HintName: Solution.g.cs // using Fallout.Persistence.Solution.Model; @@ -11,45 +11,46 @@ internal class Solution(SolutionModel model, AbsolutePath path) : Fallout.Soluti public Fallout.Solutions.Project _build => this.GetProject("_build"); public Fallout.Solutions.Project Fallout_Build => this.GetProject("Fallout.Build"); public Fallout.Solutions.Project Fallout_Build_Shared => this.GetProject("Fallout.Build.Shared"); - public Fallout.Solutions.Project Fallout_Build_Tests => this.GetProject("Fallout.Build.Tests"); + public Fallout.Solutions.Project Fallout_Build_Specs => this.GetProject("Fallout.Build.Specs"); public Fallout.Solutions.Project Fallout_Cli => this.GetProject("Fallout.Cli"); - public Fallout.Solutions.Project Fallout_Cli_Tests => this.GetProject("Fallout.Cli.Tests"); + public Fallout.Solutions.Project Fallout_Cli_Specs => this.GetProject("Fallout.Cli.Specs"); public Fallout.Solutions.Project Fallout_Common => this.GetProject("Fallout.Common"); - public Fallout.Solutions.Project Fallout_Common_Tests => this.GetProject("Fallout.Common.Tests"); + public Fallout.Solutions.Project Fallout_Common_Specs => this.GetProject("Fallout.Common.Specs"); public Fallout.Solutions.Project Fallout_Components => this.GetProject("Fallout.Components"); - public Fallout.Solutions.Project Fallout_Components_Tests => this.GetProject("Fallout.Components.Tests"); + public Fallout.Solutions.Project Fallout_Components_Specs => this.GetProject("Fallout.Components.Specs"); public Fallout.Solutions.Project Fallout_Consumer_Local => this.GetProject("Fallout.Consumer.Local"); public Fallout.Solutions.Project Fallout_Consumer_NuGet => this.GetProject("Fallout.Consumer.NuGet"); public Fallout.Solutions.Project Fallout_Core => this.GetProject("Fallout.Core"); - public Fallout.Solutions.Project Fallout_Core_Tests => this.GetProject("Fallout.Core.Tests"); + public Fallout.Solutions.Project Fallout_Core_Specs => this.GetProject("Fallout.Core.Specs"); public Fallout.Solutions.Project Fallout_Migrate => this.GetProject("Fallout.Migrate"); public Fallout.Solutions.Project Fallout_Migrate_Analyzers => this.GetProject("Fallout.Migrate.Analyzers"); - public Fallout.Solutions.Project Fallout_Migrate_Analyzers_Tests => this.GetProject("Fallout.Migrate.Analyzers.Tests"); - public Fallout.Solutions.Project Fallout_Migrate_Tests => this.GetProject("Fallout.Migrate.Tests"); + public Fallout.Solutions.Project Fallout_Migrate_Analyzers_Specs => this.GetProject("Fallout.Migrate.Analyzers.Specs"); + public Fallout.Solutions.Project Fallout_Migrate_Specs => this.GetProject("Fallout.Migrate.Specs"); public Fallout.Solutions.Project Fallout_MSBuildTasks => this.GetProject("Fallout.MSBuildTasks"); public Fallout.Solutions.Project Fallout_Persistence_Solution => this.GetProject("Fallout.Persistence.Solution"); public Fallout.Solutions.Project Fallout_Persistence_Solution_Benchmarks => this.GetProject("Fallout.Persistence.Solution.Benchmarks"); public Fallout.Solutions.Project Fallout_ProjectModel => this.GetProject("Fallout.ProjectModel"); - public Fallout.Solutions.Project Fallout_ProjectModel_Tests => this.GetProject("Fallout.ProjectModel.Tests"); + public Fallout.Solutions.Project Fallout_ProjectModel_Specs => this.GetProject("Fallout.ProjectModel.Specs"); public Fallout.Solutions.Project Fallout_Solution => this.GetProject("Fallout.Solution"); - public Fallout.Solutions.Project Fallout_Solution_Tests => this.GetProject("Fallout.Solution.Tests"); + public Fallout.Solutions.Project Fallout_Solution_Codegen => this.GetProject("Fallout.Solution.Codegen"); + public Fallout.Solutions.Project Fallout_Solution_Specs => this.GetProject("Fallout.Solution.Specs"); public Fallout.Solutions.Project Fallout_SourceGenerators => this.GetProject("Fallout.SourceGenerators"); - public Fallout.Solutions.Project Fallout_SourceGenerators_Tests => this.GetProject("Fallout.SourceGenerators.Tests"); + public Fallout.Solutions.Project Fallout_SourceGenerators_Specs => this.GetProject("Fallout.SourceGenerators.Specs"); public Fallout.Solutions.Project Fallout_Tooling => this.GetProject("Fallout.Tooling"); public Fallout.Solutions.Project Fallout_Tooling_Generator => this.GetProject("Fallout.Tooling.Generator"); - public Fallout.Solutions.Project Fallout_Tooling_Tests => this.GetProject("Fallout.Tooling.Tests"); + public Fallout.Solutions.Project Fallout_Tooling_Specs => this.GetProject("Fallout.Tooling.Specs"); public Fallout.Solutions.Project Fallout_Utilities => this.GetProject("Fallout.Utilities"); public Fallout.Solutions.Project Fallout_Utilities_IO_Compression => this.GetProject("Fallout.Utilities.IO.Compression"); public Fallout.Solutions.Project Fallout_Utilities_IO_Globbing => this.GetProject("Fallout.Utilities.IO.Globbing"); public Fallout.Solutions.Project Fallout_Utilities_Net => this.GetProject("Fallout.Utilities.Net"); - public Fallout.Solutions.Project Fallout_Utilities_Tests => this.GetProject("Fallout.Utilities.Tests"); + public Fallout.Solutions.Project Fallout_Utilities_Specs => this.GetProject("Fallout.Utilities.Specs"); public Fallout.Solutions.Project Fallout_Utilities_Text_Json => this.GetProject("Fallout.Utilities.Text.Json"); public Fallout.Solutions.Project Fallout_Utilities_Text_Yaml => this.GetProject("Fallout.Utilities.Text.Yaml"); public Fallout.Solutions.Project Nuke_Build => this.GetProject("Nuke.Build"); public Fallout.Solutions.Project Nuke_Common => this.GetProject("Nuke.Common"); - public Fallout.Solutions.Project Nuke_Common_Shim_Tests => this.GetProject("Nuke.Common.Shim.Tests"); + public Fallout.Solutions.Project Nuke_Common_Shim_Specs => this.GetProject("Nuke.Common.Shim.Specs"); public Fallout.Solutions.Project Nuke_Components => this.GetProject("Nuke.Components"); - public Fallout.Solutions.Project Nuke_Components_Shim_Tests => this.GetProject("Nuke.Components.Shim.Tests"); + public Fallout.Solutions.Project Nuke_Components_Shim_Specs => this.GetProject("Nuke.Components.Shim.Specs"); public Fallout.Solutions.Project Nuke_Consumer => this.GetProject("Nuke.Consumer"); public _misc misc => Unsafe.As<_misc>(this.GetSolutionFolder("misc")); diff --git a/tests/Fallout.SourceGenerators.Tests/StronglyTypedSolutionGeneratorTest.cs b/tests/Fallout.SourceGenerators.Specs/StronglyTypedSolutionGeneratorSpecs.cs similarity index 96% rename from tests/Fallout.SourceGenerators.Tests/StronglyTypedSolutionGeneratorTest.cs rename to tests/Fallout.SourceGenerators.Specs/StronglyTypedSolutionGeneratorSpecs.cs index 3cb6d2a52..aab87ff5b 100644 --- a/tests/Fallout.SourceGenerators.Tests/StronglyTypedSolutionGeneratorTest.cs +++ b/tests/Fallout.SourceGenerators.Specs/StronglyTypedSolutionGeneratorSpecs.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Linq; using System.Threading.Tasks; using FluentAssertions; @@ -9,9 +9,9 @@ using VerifyXunit; using Xunit; -namespace Fallout.SourceGenerators.Tests; +namespace Fallout.SourceGenerators.Specs; -public class StronglyTypedSolutionGeneratorTest +public class StronglyTypedSolutionGeneratorSpecs { [Fact] public Task Test() diff --git a/tests/Fallout.SourceGenerators.Tests/TransitionShimGeneratorTest.EmitsShimsForEachKindAndSkipsHardTier#ShimAllPublicTypesUnderAttribute.g.verified.cs b/tests/Fallout.SourceGenerators.Specs/TransitionShimGeneratorSpecs.EmitsShimsForEachKindAndSkipsHardTier#ShimAllPublicTypesUnderAttribute.g.verified.cs similarity index 100% rename from tests/Fallout.SourceGenerators.Tests/TransitionShimGeneratorTest.EmitsShimsForEachKindAndSkipsHardTier#ShimAllPublicTypesUnderAttribute.g.verified.cs rename to tests/Fallout.SourceGenerators.Specs/TransitionShimGeneratorSpecs.EmitsShimsForEachKindAndSkipsHardTier#ShimAllPublicTypesUnderAttribute.g.verified.cs diff --git a/tests/Fallout.SourceGenerators.Tests/TransitionShimGeneratorTest.EmitsShimsForEachKindAndSkipsHardTier#global__Fallout.Common.Abstr.g.verified.cs b/tests/Fallout.SourceGenerators.Specs/TransitionShimGeneratorSpecs.EmitsShimsForEachKindAndSkipsHardTier#global__Fallout.Common.Abstr.g.verified.cs similarity index 100% rename from tests/Fallout.SourceGenerators.Tests/TransitionShimGeneratorTest.EmitsShimsForEachKindAndSkipsHardTier#global__Fallout.Common.Abstr.g.verified.cs rename to tests/Fallout.SourceGenerators.Specs/TransitionShimGeneratorSpecs.EmitsShimsForEachKindAndSkipsHardTier#global__Fallout.Common.Abstr.g.verified.cs diff --git a/tests/Fallout.SourceGenerators.Tests/TransitionShimGeneratorTest.EmitsShimsForEachKindAndSkipsHardTier#global__Fallout.Common.Generic_T_.g.verified.cs b/tests/Fallout.SourceGenerators.Specs/TransitionShimGeneratorSpecs.EmitsShimsForEachKindAndSkipsHardTier#global__Fallout.Common.Generic_T_.g.verified.cs similarity index 100% rename from tests/Fallout.SourceGenerators.Tests/TransitionShimGeneratorTest.EmitsShimsForEachKindAndSkipsHardTier#global__Fallout.Common.Generic_T_.g.verified.cs rename to tests/Fallout.SourceGenerators.Specs/TransitionShimGeneratorSpecs.EmitsShimsForEachKindAndSkipsHardTier#global__Fallout.Common.Generic_T_.g.verified.cs diff --git a/tests/Fallout.SourceGenerators.Tests/TransitionShimGeneratorTest.EmitsShimsForEachKindAndSkipsHardTier#global__Fallout.Common.IFoo.g.verified.cs b/tests/Fallout.SourceGenerators.Specs/TransitionShimGeneratorSpecs.EmitsShimsForEachKindAndSkipsHardTier#global__Fallout.Common.IFoo.g.verified.cs similarity index 100% rename from tests/Fallout.SourceGenerators.Tests/TransitionShimGeneratorTest.EmitsShimsForEachKindAndSkipsHardTier#global__Fallout.Common.IFoo.g.verified.cs rename to tests/Fallout.SourceGenerators.Specs/TransitionShimGeneratorSpecs.EmitsShimsForEachKindAndSkipsHardTier#global__Fallout.Common.IFoo.g.verified.cs diff --git a/tests/Fallout.SourceGenerators.Tests/TransitionShimGeneratorTest.EmitsShimsForEachKindAndSkipsHardTier#global__Fallout.Common.MyAttr.g.verified.cs b/tests/Fallout.SourceGenerators.Specs/TransitionShimGeneratorSpecs.EmitsShimsForEachKindAndSkipsHardTier#global__Fallout.Common.MyAttr.g.verified.cs similarity index 100% rename from tests/Fallout.SourceGenerators.Tests/TransitionShimGeneratorTest.EmitsShimsForEachKindAndSkipsHardTier#global__Fallout.Common.MyAttr.g.verified.cs rename to tests/Fallout.SourceGenerators.Specs/TransitionShimGeneratorSpecs.EmitsShimsForEachKindAndSkipsHardTier#global__Fallout.Common.MyAttr.g.verified.cs diff --git a/tests/Fallout.SourceGenerators.Tests/TransitionShimGeneratorTest.EmitsShimsForEachKindAndSkipsHardTier#global__Fallout.Common.Regular.g.verified.cs b/tests/Fallout.SourceGenerators.Specs/TransitionShimGeneratorSpecs.EmitsShimsForEachKindAndSkipsHardTier#global__Fallout.Common.Regular.g.verified.cs similarity index 100% rename from tests/Fallout.SourceGenerators.Tests/TransitionShimGeneratorTest.EmitsShimsForEachKindAndSkipsHardTier#global__Fallout.Common.Regular.g.verified.cs rename to tests/Fallout.SourceGenerators.Specs/TransitionShimGeneratorSpecs.EmitsShimsForEachKindAndSkipsHardTier#global__Fallout.Common.Regular.g.verified.cs diff --git a/tests/Fallout.SourceGenerators.Tests/TransitionShimGeneratorTest.EmitsShimsForEachKindAndSkipsHardTier#global__Fallout.Common.StaticHelpers.g.verified.cs b/tests/Fallout.SourceGenerators.Specs/TransitionShimGeneratorSpecs.EmitsShimsForEachKindAndSkipsHardTier#global__Fallout.Common.StaticHelpers.g.verified.cs similarity index 100% rename from tests/Fallout.SourceGenerators.Tests/TransitionShimGeneratorTest.EmitsShimsForEachKindAndSkipsHardTier#global__Fallout.Common.StaticHelpers.g.verified.cs rename to tests/Fallout.SourceGenerators.Specs/TransitionShimGeneratorSpecs.EmitsShimsForEachKindAndSkipsHardTier#global__Fallout.Common.StaticHelpers.g.verified.cs diff --git a/tests/Fallout.SourceGenerators.Tests/TransitionShimGeneratorTest.EmitsShimsForEachKindAndSkipsHardTier#global__Fallout.Common.WithNested.g.verified.cs b/tests/Fallout.SourceGenerators.Specs/TransitionShimGeneratorSpecs.EmitsShimsForEachKindAndSkipsHardTier#global__Fallout.Common.WithNested.g.verified.cs similarity index 100% rename from tests/Fallout.SourceGenerators.Tests/TransitionShimGeneratorTest.EmitsShimsForEachKindAndSkipsHardTier#global__Fallout.Common.WithNested.g.verified.cs rename to tests/Fallout.SourceGenerators.Specs/TransitionShimGeneratorSpecs.EmitsShimsForEachKindAndSkipsHardTier#global__Fallout.Common.WithNested.g.verified.cs diff --git a/tests/Fallout.SourceGenerators.Tests/TransitionShimGeneratorTest.EmitsShimsForEachKindAndSkipsHardTier.verified.txt b/tests/Fallout.SourceGenerators.Specs/TransitionShimGeneratorSpecs.EmitsShimsForEachKindAndSkipsHardTier.verified.txt similarity index 100% rename from tests/Fallout.SourceGenerators.Tests/TransitionShimGeneratorTest.EmitsShimsForEachKindAndSkipsHardTier.verified.txt rename to tests/Fallout.SourceGenerators.Specs/TransitionShimGeneratorSpecs.EmitsShimsForEachKindAndSkipsHardTier.verified.txt diff --git a/tests/Fallout.SourceGenerators.Tests/TransitionShimGeneratorTest.cs b/tests/Fallout.SourceGenerators.Specs/TransitionShimGeneratorSpecs.cs similarity index 98% rename from tests/Fallout.SourceGenerators.Tests/TransitionShimGeneratorTest.cs rename to tests/Fallout.SourceGenerators.Specs/TransitionShimGeneratorSpecs.cs index 30d8ac333..307f32483 100644 --- a/tests/Fallout.SourceGenerators.Tests/TransitionShimGeneratorTest.cs +++ b/tests/Fallout.SourceGenerators.Specs/TransitionShimGeneratorSpecs.cs @@ -7,9 +7,9 @@ using VerifyXunit; using Xunit; -namespace Fallout.SourceGenerators.Tests; +namespace Fallout.SourceGenerators.Specs; -public class TransitionShimGeneratorTest +public class TransitionShimGeneratorSpecs { // Each kind in the Easy tier (regular class, abstract class, interface, // attribute, generic class, nested type) emits a representative shim. The diff --git a/tests/Fallout.SourceGenerators.Tests/VerifyTestsInitializer.cs b/tests/Fallout.SourceGenerators.Specs/VerifySpecsInitializer.cs similarity index 87% rename from tests/Fallout.SourceGenerators.Tests/VerifyTestsInitializer.cs rename to tests/Fallout.SourceGenerators.Specs/VerifySpecsInitializer.cs index 36f4b5d73..23c99bdbb 100644 --- a/tests/Fallout.SourceGenerators.Tests/VerifyTestsInitializer.cs +++ b/tests/Fallout.SourceGenerators.Specs/VerifySpecsInitializer.cs @@ -1,8 +1,8 @@ -using System; +using System; using System.Runtime.CompilerServices; using VerifyTests; -namespace Fallout.SourceGenerators.Tests; +namespace Fallout.SourceGenerators.Specs; public static class VerifyTestsInitializer { diff --git a/tests/Fallout.Tooling.Tests/ArgumentStringHandlerTest.cs b/tests/Fallout.Tooling.Specs/ArgumentStringHandlerSpecs.cs similarity index 97% rename from tests/Fallout.Tooling.Tests/ArgumentStringHandlerTest.cs rename to tests/Fallout.Tooling.Specs/ArgumentStringHandlerSpecs.cs index b8aa54e4e..2970512e2 100644 --- a/tests/Fallout.Tooling.Tests/ArgumentStringHandlerTest.cs +++ b/tests/Fallout.Tooling.Specs/ArgumentStringHandlerSpecs.cs @@ -5,9 +5,9 @@ // ReSharper disable StringLiteralAsInterpolationArgument -namespace Fallout.Common.Tests; +namespace Fallout.Common.Specs; -public class ArgumentStringHandlerTest +public class ArgumentStringHandlerSpecs { [Fact] public void Test() diff --git a/tests/Fallout.Tooling.Tests/Fallout.Tooling.Tests.csproj b/tests/Fallout.Tooling.Specs/Fallout.Tooling.Specs.csproj similarity index 100% rename from tests/Fallout.Tooling.Tests/Fallout.Tooling.Tests.csproj rename to tests/Fallout.Tooling.Specs/Fallout.Tooling.Specs.csproj diff --git a/tests/Fallout.Tooling.Tests/NuGetPackageResolverTest.cs b/tests/Fallout.Tooling.Specs/NuGetPackageResolverSpecs.cs similarity index 95% rename from tests/Fallout.Tooling.Tests/NuGetPackageResolverTest.cs rename to tests/Fallout.Tooling.Specs/NuGetPackageResolverSpecs.cs index 5f9cee5bd..28f6ede0e 100644 --- a/tests/Fallout.Tooling.Tests/NuGetPackageResolverTest.cs +++ b/tests/Fallout.Tooling.Specs/NuGetPackageResolverSpecs.cs @@ -4,13 +4,13 @@ using Fallout.Common.Tooling; using Xunit; -namespace Fallout.Common.Tests; +namespace Fallout.Common.Specs; -public class NuGetPackageResolverTest +public class NuGetPackageResolverSpecs { private static AbsolutePath RootDirectory => Constants.TryGetRootDirectoryFrom(EnvironmentInfo.WorkingDirectory).NotNull(); - private static AbsolutePath ProjectFile => RootDirectory / "tests" / "Fallout.Tooling.Tests" / "Fallout.Tooling.Tests.csproj"; + private static AbsolutePath ProjectFile => RootDirectory / "tests" / "Fallout.Tooling.Specs" / "Fallout.Tooling.Specs.csproj"; private static AbsolutePath AssetsFile => ProjectFile.Parent / "obj" / "project.assets.json"; private const string XunitConsolePackageVersion = "2.6.1"; diff --git a/tests/Fallout.Tooling.Tests/OptionsTest.TestSerialization.verified.txt b/tests/Fallout.Tooling.Specs/OptionsSpecs.TestSerialization.verified.txt similarity index 100% rename from tests/Fallout.Tooling.Tests/OptionsTest.TestSerialization.verified.txt rename to tests/Fallout.Tooling.Specs/OptionsSpecs.TestSerialization.verified.txt diff --git a/tests/Fallout.Tooling.Tests/OptionsTest.cs b/tests/Fallout.Tooling.Specs/OptionsSpecs.cs similarity index 99% rename from tests/Fallout.Tooling.Tests/OptionsTest.cs rename to tests/Fallout.Tooling.Specs/OptionsSpecs.cs index 06e1455a6..4a58fa56f 100644 --- a/tests/Fallout.Tooling.Tests/OptionsTest.cs +++ b/tests/Fallout.Tooling.Specs/OptionsSpecs.cs @@ -12,9 +12,9 @@ using VerifyXunit; using Xunit; -namespace Fallout.Common.Tests; +namespace Fallout.Common.Specs; -public class OptionsTest +public class OptionsSpecs { // ReSharper disable UnassignedGetOnlyAutoProperty private string ScalarValue { get; } diff --git a/tests/Fallout.Tooling.Tests/ToolOptionsArgumentsTest.cs b/tests/Fallout.Tooling.Specs/ToolOptionsArgumentsSpecs.cs similarity index 99% rename from tests/Fallout.Tooling.Tests/ToolOptionsArgumentsTest.cs rename to tests/Fallout.Tooling.Specs/ToolOptionsArgumentsSpecs.cs index db70ebf52..1fede9a94 100644 --- a/tests/Fallout.Tooling.Tests/ToolOptionsArgumentsTest.cs +++ b/tests/Fallout.Tooling.Specs/ToolOptionsArgumentsSpecs.cs @@ -11,9 +11,9 @@ using Fallout.Common.Utilities.Collections; using Xunit; -namespace Fallout.Common.Tests; +namespace Fallout.Common.Specs; -public class ToolOptionsArgumentsTest +public class ToolOptionsArgumentsSpecs { [Fact] public void TestBool_Simple() => Assert(new { Bool = true }, ["/bool:true",]); [Fact] public void TestBool_FlagTrue() => Assert(new { Flag = true }, ["/flag"]); diff --git a/tests/Fallout.Tooling.Tests/ToolTasksLoggerTest.cs b/tests/Fallout.Tooling.Specs/ToolTasksLoggerSpecs.cs similarity index 96% rename from tests/Fallout.Tooling.Tests/ToolTasksLoggerTest.cs rename to tests/Fallout.Tooling.Specs/ToolTasksLoggerSpecs.cs index e6d50e927..38f930a05 100644 --- a/tests/Fallout.Tooling.Tests/ToolTasksLoggerTest.cs +++ b/tests/Fallout.Tooling.Specs/ToolTasksLoggerSpecs.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using FluentAssertions; @@ -8,13 +8,13 @@ using Serilog.Events; using Xunit; -namespace Fallout.Common.Tests; +namespace Fallout.Common.Specs; -public class ToolTasksLoggerTest +public class ToolTasksLoggerSpecs { private readonly List _logEvents = new(); - public ToolTasksLoggerTest() + public ToolTasksLoggerSpecs() { var memorySink = new InMemorySink(); Log.Logger = new LoggerConfiguration() diff --git a/tests/Fallout.Tooling.Tests/ToolTasksToolPathTest.cs b/tests/Fallout.Tooling.Specs/ToolTasksToolPathSpecs.cs similarity index 94% rename from tests/Fallout.Tooling.Tests/ToolTasksToolPathTest.cs rename to tests/Fallout.Tooling.Specs/ToolTasksToolPathSpecs.cs index 96474a262..dca4c5b0b 100644 --- a/tests/Fallout.Tooling.Tests/ToolTasksToolPathTest.cs +++ b/tests/Fallout.Tooling.Specs/ToolTasksToolPathSpecs.cs @@ -5,11 +5,11 @@ using Fallout.Common.Tooling; using Xunit; -namespace Fallout.Common.Tests; +namespace Fallout.Common.Specs; -public class ToolTasksToolPathTest +public class ToolTasksToolPathSpecs { - public ToolTasksToolPathTest() + public ToolTasksToolPathSpecs() { var rootDirectory = Constants.TryGetRootDirectoryFrom(EnvironmentInfo.WorkingDirectory); NuGetToolPathResolver.NuGetPackagesConfigFile = rootDirectory / "build" / "_build.csproj"; diff --git a/tests/Fallout.Utilities.Tests/ArgumentParserTest.cs b/tests/Fallout.Utilities.Specs/ArgumentParserSpecs.cs similarity index 98% rename from tests/Fallout.Utilities.Tests/ArgumentParserTest.cs rename to tests/Fallout.Utilities.Specs/ArgumentParserSpecs.cs index 46612aeb9..6ff2ca7f8 100644 --- a/tests/Fallout.Utilities.Tests/ArgumentParserTest.cs +++ b/tests/Fallout.Utilities.Specs/ArgumentParserSpecs.cs @@ -3,9 +3,9 @@ using FluentAssertions; using Xunit; -namespace Fallout.Common.Tests; +namespace Fallout.Common.Specs; -public class ArgumentParserTest +public class ArgumentParserSpecs { [Theory] [InlineData("arg0 arg1 arg2", new[] { "arg0", "arg1", "arg2" })] diff --git a/tests/Fallout.Utilities.Tests/Collections/DictionaryExtensionsTest.cs b/tests/Fallout.Utilities.Specs/Collections/DictionaryExtensionsSpecs.cs similarity index 83% rename from tests/Fallout.Utilities.Tests/Collections/DictionaryExtensionsTest.cs rename to tests/Fallout.Utilities.Specs/Collections/DictionaryExtensionsSpecs.cs index d6390fa29..51fb43d77 100644 --- a/tests/Fallout.Utilities.Tests/Collections/DictionaryExtensionsTest.cs +++ b/tests/Fallout.Utilities.Specs/Collections/DictionaryExtensionsSpecs.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections; using System.Collections.Generic; using System.Linq; @@ -6,9 +6,9 @@ using Fallout.Common.Utilities.Collections; using Xunit; -namespace Fallout.Common.Tests; +namespace Fallout.Common.Specs; -public class DictionaryExtensionsTest +public class DictionaryExtensionsSpecs { [Fact] public static void ToGeneric() diff --git a/tests/Fallout.Utilities.Tests/Collections/EnumerableExtensionsTest.cs b/tests/Fallout.Utilities.Specs/Collections/EnumerableExtensionsSpecs.cs similarity index 89% rename from tests/Fallout.Utilities.Tests/Collections/EnumerableExtensionsTest.cs rename to tests/Fallout.Utilities.Specs/Collections/EnumerableExtensionsSpecs.cs index ac15f80ce..63239b28b 100644 --- a/tests/Fallout.Utilities.Tests/Collections/EnumerableExtensionsTest.cs +++ b/tests/Fallout.Utilities.Specs/Collections/EnumerableExtensionsSpecs.cs @@ -1,12 +1,12 @@ -using System; +using System; using System.Linq; using FluentAssertions; using Fallout.Common.Utilities.Collections; using Xunit; -namespace Fallout.Common.Tests; +namespace Fallout.Common.Specs; -public class EnumerableExtensionsTest +public class EnumerableExtensionsSpecs { [Fact] public void SingleOrDefaultOrError_ThrowsExceptionWithMessage() diff --git a/tests/Fallout.Utilities.Tests/Collections/LookupTableTest.cs b/tests/Fallout.Utilities.Specs/Collections/LookupTableSpecs.cs similarity index 94% rename from tests/Fallout.Utilities.Tests/Collections/LookupTableTest.cs rename to tests/Fallout.Utilities.Specs/Collections/LookupTableSpecs.cs index c5db832b7..e7d787606 100644 --- a/tests/Fallout.Utilities.Tests/Collections/LookupTableTest.cs +++ b/tests/Fallout.Utilities.Specs/Collections/LookupTableSpecs.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Linq; using FluentAssertions; using Fallout.Common.Utilities.Collections; @@ -6,9 +6,9 @@ // ReSharper disable ArgumentsStyleLiteral -namespace Fallout.Common.Tests; +namespace Fallout.Common.Specs; -public class LookupTableTest +public class LookupTableSpecs { [Fact] public void Test() diff --git a/tests/Fallout.Utilities.Tests/EncryptionUtilityTest.cs b/tests/Fallout.Utilities.Specs/EncryptionUtilitySpecs.cs similarity index 98% rename from tests/Fallout.Utilities.Tests/EncryptionUtilityTest.cs rename to tests/Fallout.Utilities.Specs/EncryptionUtilitySpecs.cs index 54897de9d..8cd55c115 100644 --- a/tests/Fallout.Utilities.Tests/EncryptionUtilityTest.cs +++ b/tests/Fallout.Utilities.Specs/EncryptionUtilitySpecs.cs @@ -3,9 +3,9 @@ using FluentAssertions; using Xunit; -namespace Fallout.Common.Tests; +namespace Fallout.Common.Specs; -public class EncryptionUtilityTest +public class EncryptionUtilitySpecs { [Fact] public void V2_RoundTrip() diff --git a/tests/Fallout.Utilities.Tests/EnvironmentInfoTest.cs b/tests/Fallout.Utilities.Specs/EnvironmentInfoSpecs.cs similarity index 78% rename from tests/Fallout.Utilities.Tests/EnvironmentInfoTest.cs rename to tests/Fallout.Utilities.Specs/EnvironmentInfoSpecs.cs index 106d678fa..d4cb5d04e 100644 --- a/tests/Fallout.Utilities.Tests/EnvironmentInfoTest.cs +++ b/tests/Fallout.Utilities.Specs/EnvironmentInfoSpecs.cs @@ -1,12 +1,12 @@ -using System; +using System; using System.Linq; using FluentAssertions; using Fallout.Common.IO; using Xunit; -namespace Fallout.Common.Tests; +namespace Fallout.Common.Specs; -public class EnvironmentInfoTest +public class EnvironmentInfoSpecs { [Fact] public void TestPaths() diff --git a/tests/Fallout.Utilities.Tests/Fallout.Utilities.Tests.csproj b/tests/Fallout.Utilities.Specs/Fallout.Utilities.Specs.csproj similarity index 100% rename from tests/Fallout.Utilities.Tests/Fallout.Utilities.Tests.csproj rename to tests/Fallout.Utilities.Specs/Fallout.Utilities.Specs.csproj diff --git a/tests/Fallout.Utilities.Tests/IO/CompressionTasksTest.cs b/tests/Fallout.Utilities.Specs/IO/CompressionTasksSpecs.cs similarity index 88% rename from tests/Fallout.Utilities.Tests/IO/CompressionTasksTest.cs rename to tests/Fallout.Utilities.Specs/IO/CompressionTasksSpecs.cs index 067a5d673..7e8fd9271 100644 --- a/tests/Fallout.Utilities.Tests/IO/CompressionTasksTest.cs +++ b/tests/Fallout.Utilities.Specs/IO/CompressionTasksSpecs.cs @@ -6,14 +6,14 @@ using Xunit; using Xunit.Abstractions; -namespace Fallout.Common.Tests; +namespace Fallout.Common.Specs; -public class CompressionTasksTest : FileSystemDependentTest +public class CompressionTasksSpecs : FileSystemDependentSpecs { private AbsolutePath RootFile => TestTempDirectory / "root-file"; private AbsolutePath NestedFile => TestTempDirectory / "a" / "b" / "c" / "nested-file"; - public CompressionTasksTest(ITestOutputHelper testOutputHelper) + public CompressionTasksSpecs(ITestOutputHelper testOutputHelper) : base(testOutputHelper) { } diff --git a/tests/Fallout.Utilities.Tests/IO/FileSystemDependentTest.cs b/tests/Fallout.Utilities.Specs/IO/FileSystemDependentSpecs.cs similarity index 88% rename from tests/Fallout.Utilities.Tests/IO/FileSystemDependentTest.cs rename to tests/Fallout.Utilities.Specs/IO/FileSystemDependentSpecs.cs index 45574baa9..0de1336c0 100644 --- a/tests/Fallout.Utilities.Tests/IO/FileSystemDependentTest.cs +++ b/tests/Fallout.Utilities.Specs/IO/FileSystemDependentSpecs.cs @@ -6,9 +6,9 @@ using Fallout.Common.IO; using Xunit.Abstractions; -namespace Fallout.Common.Tests; +namespace Fallout.Common.Specs; -public abstract class FileSystemDependentTest +public abstract class FileSystemDependentSpecs { public ITestOutputHelper TestOutputHelper { get; } public string TestName { get; } @@ -17,7 +17,7 @@ public abstract class FileSystemDependentTest public AbsolutePath RootDirectory { get; } public AbsolutePath TestTempDirectory { get; } - protected FileSystemDependentTest(ITestOutputHelper testOutputHelper) + protected FileSystemDependentSpecs(ITestOutputHelper testOutputHelper) { TestOutputHelper = testOutputHelper; diff --git a/tests/Fallout.Utilities.Tests/IO/MoveCopyTest.cs b/tests/Fallout.Utilities.Specs/IO/MoveCopySpecs.cs similarity index 96% rename from tests/Fallout.Utilities.Tests/IO/MoveCopyTest.cs rename to tests/Fallout.Utilities.Specs/IO/MoveCopySpecs.cs index c09230be5..37729a381 100644 --- a/tests/Fallout.Utilities.Tests/IO/MoveCopyTest.cs +++ b/tests/Fallout.Utilities.Specs/IO/MoveCopySpecs.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Linq; using FluentAssertions; using Fallout.Common.IO; @@ -6,11 +6,11 @@ using Xunit; using Xunit.Abstractions; -namespace Fallout.Common.Tests; +namespace Fallout.Common.Specs; -public class MoveCopyTest : FileSystemDependentTest +public class MoveCopySpecs : FileSystemDependentSpecs { - public MoveCopyTest(ITestOutputHelper testOutputHelper) : base(testOutputHelper) + public MoveCopySpecs(ITestOutputHelper testOutputHelper) : base(testOutputHelper) { AbsolutePathExtensions.DefaultEofLineBreak = false; } diff --git a/tests/Fallout.Utilities.Tests/IO/PathConstructionTest.cs b/tests/Fallout.Utilities.Specs/IO/PathConstructionSpecs.cs similarity index 99% rename from tests/Fallout.Utilities.Tests/IO/PathConstructionTest.cs rename to tests/Fallout.Utilities.Specs/IO/PathConstructionSpecs.cs index b70d78a88..bf3635c5d 100644 --- a/tests/Fallout.Utilities.Tests/IO/PathConstructionTest.cs +++ b/tests/Fallout.Utilities.Specs/IO/PathConstructionSpecs.cs @@ -5,9 +5,9 @@ using Xunit; using static Fallout.Common.IO.PathConstruction; -namespace Fallout.Common.Tests; +namespace Fallout.Common.Specs; -public class PathConstructionTest +public class PathConstructionSpecs { [Theory] [InlineData("C:\\A\\B", "C:\\A")] diff --git a/tests/Fallout.Utilities.Tests/Reflection/ReflectionUtilityTest.cs b/tests/Fallout.Utilities.Specs/Reflection/ReflectionUtilitySpecs.cs similarity index 93% rename from tests/Fallout.Utilities.Tests/Reflection/ReflectionUtilityTest.cs rename to tests/Fallout.Utilities.Specs/Reflection/ReflectionUtilitySpecs.cs index 7f77235a6..b90e41e79 100644 --- a/tests/Fallout.Utilities.Tests/Reflection/ReflectionUtilityTest.cs +++ b/tests/Fallout.Utilities.Specs/Reflection/ReflectionUtilitySpecs.cs @@ -6,9 +6,9 @@ using Fallout.Common.Utilities; using Xunit; -namespace Fallout.Common.Tests.Execution; +namespace Fallout.Common.Specs.Execution; -public class ReflectionUtilityTest +public class ReflectionUtilitySpecs { [Theory] [InlineData(typeof(string), true)] @@ -17,7 +17,7 @@ public class ReflectionUtilityTest [InlineData(typeof(object), true)] [InlineData(typeof(bool), false)] [InlineData(typeof(bool[]), true)] - [InlineData(typeof(ReflectionUtilityTest), true)] + [InlineData(typeof(ReflectionUtilitySpecs), true)] public void TestIsNullableType(Type type, bool expected) { type.IsNullableType().Should().Be(expected); @@ -28,7 +28,7 @@ public void TestIsNullableType(Type type, bool expected) [InlineData(typeof(bool?), typeof(bool?))] [InlineData(typeof(string), typeof(string))] [InlineData(typeof(object[]), typeof(object[]))] - [InlineData(typeof(ReflectionUtilityTest), typeof(ReflectionUtilityTest))] + [InlineData(typeof(ReflectionUtilitySpecs), typeof(ReflectionUtilitySpecs))] public void TestGetNullableType(Type type, Type expected) { type.GetNullableType().Should().Be(expected); diff --git a/tests/Fallout.Utilities.Tests/Text/SerializationTest.cs b/tests/Fallout.Utilities.Specs/Text/SerializationSpecs.cs similarity index 90% rename from tests/Fallout.Utilities.Tests/Text/SerializationTest.cs rename to tests/Fallout.Utilities.Specs/Text/SerializationSpecs.cs index d0e621a51..cd1237559 100644 --- a/tests/Fallout.Utilities.Tests/Text/SerializationTest.cs +++ b/tests/Fallout.Utilities.Specs/Text/SerializationSpecs.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using FluentAssertions; @@ -7,12 +7,12 @@ using Fallout.Utilities.Text.Yaml; using Xunit; -namespace Fallout.Common.Tests; +namespace Fallout.Common.Specs; -public class SerializationTest +public class SerializationSpecs { [Fact] - public void JsonTest() + public void JsonSpec() { var data = CreateData("Json"); #pragma warning disable CS0618 // Test pins Newtonsoft round-trip semantics; STJ equivalents will get their own test cases in v11. @@ -24,7 +24,7 @@ public void JsonTest() } [Fact] - public void YamlTest() + public void YamlSpec() { var data = CreateData("Yaml"); var content = data.ToYaml(); @@ -34,7 +34,7 @@ public void YamlTest() } [Fact] - public void XmlTest() + public void XmlSpec() { var data = CreateData("Xml"); var content = data.ToXml(); diff --git a/tests/Fallout.Utilities.Tests/Text/StringExtensionsTest.cs b/tests/Fallout.Utilities.Specs/Text/StringExtensionsSpecs.cs similarity index 95% rename from tests/Fallout.Utilities.Tests/Text/StringExtensionsTest.cs rename to tests/Fallout.Utilities.Specs/Text/StringExtensionsSpecs.cs index ee79563bb..84cc8e3ac 100644 --- a/tests/Fallout.Utilities.Tests/Text/StringExtensionsTest.cs +++ b/tests/Fallout.Utilities.Specs/Text/StringExtensionsSpecs.cs @@ -1,12 +1,12 @@ -using System; +using System; using System.Linq; using FluentAssertions; using Fallout.Common.Utilities; using Xunit; -namespace Fallout.Common.Tests; +namespace Fallout.Common.Specs; -public class StringExtensionsTest +public class StringExtensionsSpecs { [Theory] [InlineData("a b c", "\"a b c\"")] diff --git a/tests/Nuke.Common.Shim.Specs/HostDetectionSpecs.cs b/tests/Nuke.Common.Shim.Specs/HostDetectionSpecs.cs new file mode 100644 index 000000000..c475e5cb2 --- /dev/null +++ b/tests/Nuke.Common.Shim.Specs/HostDetectionSpecs.cs @@ -0,0 +1,35 @@ +using System.Linq; +using System.Reflection; +using FluentAssertions; +using Xunit; + +namespace Nuke.Common.Shim.Specs; + +// Runtime counterpart to the compile-only SampleConsumerBuild: actually exercises host +// auto-detection with the shim loaded. The shim emits a public Host subclass +// (`Nuke.Common.Host`) that doesn't follow the `IsRunning{Name}` convention; detection +// used to assert-throw on it inside FalloutBuild's static ctor, aborting every build that +// referenced the shim. Compile-only tests never caught it because they never run a build. +// See Fallout.Canary#3. +public class HostDetectionSpecs +{ + [Fact] + public void FalloutBuildHost_Resolves_DespiteConventionLessShimHostSubclass() + { + // Force the Nuke.Common shim assembly to load so detection sees its types. + var shimAssembly = typeof(global::Nuke.Common.NukeBuild).Assembly; + + // Precondition: the shim really does emit a public, convention-less Host subclass. + // Without one, this regression test has no teeth. + var offenders = shimAssembly.GetTypes() + .Where(t => t.IsPublic && t.IsSubclassOf(typeof(global::Fallout.Common.Host))) + .Where(t => t.GetProperty($"IsRunning{t.Name}", BindingFlags.Public | BindingFlags.Static) is null) + .ToList(); + offenders.Should().NotBeEmpty(); + + // Touching FalloutBuild runs its static ctor -> Host.Default, scanning every public + // Host subclass. Resolving the property (not throwing) is the assertion. + var host = global::Fallout.Common.FalloutBuild.Host; + host.Should().NotBeNull(); + } +} diff --git a/tests/Nuke.Common.Shim.Tests/Nuke.Common.Shim.Tests.csproj b/tests/Nuke.Common.Shim.Specs/Nuke.Common.Shim.Specs.csproj similarity index 100% rename from tests/Nuke.Common.Shim.Tests/Nuke.Common.Shim.Tests.csproj rename to tests/Nuke.Common.Shim.Specs/Nuke.Common.Shim.Specs.csproj diff --git a/tests/Nuke.Common.Shim.Tests/SampleConsumerBuild.cs b/tests/Nuke.Common.Shim.Specs/SampleConsumerBuild.cs similarity index 98% rename from tests/Nuke.Common.Shim.Tests/SampleConsumerBuild.cs rename to tests/Nuke.Common.Shim.Specs/SampleConsumerBuild.cs index a04033404..12dd96537 100644 --- a/tests/Nuke.Common.Shim.Tests/SampleConsumerBuild.cs +++ b/tests/Nuke.Common.Shim.Specs/SampleConsumerBuild.cs @@ -16,7 +16,7 @@ using Nuke.Common.ProjectModel; using Nuke.Common.Utilities; -namespace Nuke.Common.Shim.Tests; +namespace Nuke.Common.Shim.Specs; // Consumer's typical Build.cs entry-point — inherits the shim's NukeBuild, // uses the canonical Fallout types via `Fallout.Common.Target` (shim doesn't diff --git a/tests/Nuke.Common.Shim.Tests/ShimCompilesTests.cs b/tests/Nuke.Common.Shim.Specs/ShimCompilesSpecs.cs similarity index 93% rename from tests/Nuke.Common.Shim.Tests/ShimCompilesTests.cs rename to tests/Nuke.Common.Shim.Specs/ShimCompilesSpecs.cs index 29551342d..5ff31ebbe 100644 --- a/tests/Nuke.Common.Shim.Tests/ShimCompilesTests.cs +++ b/tests/Nuke.Common.Shim.Specs/ShimCompilesSpecs.cs @@ -1,6 +1,6 @@ using Xunit; -namespace Nuke.Common.Shim.Tests; +namespace Nuke.Common.Shim.Specs; // The whole point of this project is to verify that SampleConsumerBuild.cs // compiles against the Nuke.* shim — the build IS the test. But xUnit's @@ -12,7 +12,7 @@ namespace Nuke.Common.Shim.Tests; // This trivial test makes discovery succeed on all platforms and explicitly // encodes the project's contract: if you can build it, the shim covers the // surface SampleConsumerBuild exercises. -public class ShimCompilesTests +public class ShimCompilesSpecs { [Fact] public void Shim_Compiles_When_Test_Assembly_Loads() diff --git a/tests/Nuke.Components.Shim.Tests/Nuke.Components.Shim.Tests.csproj b/tests/Nuke.Components.Shim.Specs/Nuke.Components.Shim.Specs.csproj similarity index 100% rename from tests/Nuke.Components.Shim.Tests/Nuke.Components.Shim.Tests.csproj rename to tests/Nuke.Components.Shim.Specs/Nuke.Components.Shim.Specs.csproj diff --git a/tests/Nuke.Components.Shim.Tests/SampleConsumerBuild.cs b/tests/Nuke.Components.Shim.Specs/SampleConsumerBuild.cs similarity index 96% rename from tests/Nuke.Components.Shim.Tests/SampleConsumerBuild.cs rename to tests/Nuke.Components.Shim.Specs/SampleConsumerBuild.cs index 12a555db9..880fc9119 100644 --- a/tests/Nuke.Components.Shim.Tests/SampleConsumerBuild.cs +++ b/tests/Nuke.Components.Shim.Specs/SampleConsumerBuild.cs @@ -10,7 +10,7 @@ using Nuke.Common; using Nuke.Components; -namespace Nuke.Components.Shim.Tests; +namespace Nuke.Components.Shim.Specs; // Exercises every IHaz* alias in one type. Abstract so we don't have to // satisfy any concrete-build requirements — declaration alone proves the diff --git a/tests/Nuke.Components.Shim.Tests/ShimCompilesTests.cs b/tests/Nuke.Components.Shim.Specs/ShimCompilesSpecs.cs similarity index 88% rename from tests/Nuke.Components.Shim.Tests/ShimCompilesTests.cs rename to tests/Nuke.Components.Shim.Specs/ShimCompilesSpecs.cs index 3d2ddabd1..7cbe98c1a 100644 --- a/tests/Nuke.Components.Shim.Tests/ShimCompilesTests.cs +++ b/tests/Nuke.Components.Shim.Specs/ShimCompilesSpecs.cs @@ -1,6 +1,6 @@ using Xunit; -namespace Nuke.Components.Shim.Tests; +namespace Nuke.Components.Shim.Specs; // The whole point of this project is to verify that SampleConsumerBuild.cs // compiles against the Nuke.Components shim — the build IS the test. But @@ -8,7 +8,7 @@ namespace Nuke.Components.Shim.Tests; // discoverable tests as an error on Windows (exit code 1) while emitting only // a warning on Linux/macOS. This trivial test makes discovery succeed on all // platforms. -public class ShimCompilesTests +public class ShimCompilesSpecs { [Fact] public void Shim_Compiles_When_Test_Assembly_Loads()