From 51fa24eb1eacb31728fda6e4d8f62c6eebe95369 Mon Sep 17 00:00:00 2001 From: net0well Date: Wed, 21 Oct 2026 17:32:17 -0300 Subject: [PATCH 1/4] build: add solution, shared build settings and empty packages --- .editorconfig | 65 ++++++ Directory.Build.props | 48 ++++ Directory.Packages.props | 18 ++ WalterEgo.slnx | 25 ++ eng/BannedSymbols.txt | 28 +++ global.json | 9 + nuget.config | 12 + .../WalterEgo.Samples.MinimalApi/Program.cs | 5 + .../WalterEgo.Samples.MinimalApi.csproj | 7 + .../packages.lock.json | 22 ++ src/Directory.Build.props | 19 ++ .../PublicAPI.Shipped.txt | 1 + .../PublicAPI.Unshipped.txt | 1 + .../WalterEgo.Alerting.Webhook.csproj | 16 ++ .../packages.lock.json | 34 +++ .../PublicAPI.Shipped.txt | 1 + .../PublicAPI.Unshipped.txt | 1 + .../WalterEgo.AspNetCore.Identity.csproj | 16 ++ .../packages.lock.json | 40 ++++ .../PublicAPI.Shipped.txt | 1 + .../PublicAPI.Unshipped.txt | 1 + .../WalterEgo.AspNetCore.csproj | 16 ++ src/WalterEgo.AspNetCore/packages.lock.json | 34 +++ src/WalterEgo.Cli/Program.cs | 1 + src/WalterEgo.Cli/PublicAPI.Shipped.txt | 1 + src/WalterEgo.Cli/PublicAPI.Unshipped.txt | 1 + src/WalterEgo.Cli/WalterEgo.Cli.csproj | 18 ++ src/WalterEgo.Cli/packages.lock.json | 34 +++ src/WalterEgo.Core/PublicAPI.Shipped.txt | 1 + src/WalterEgo.Core/PublicAPI.Unshipped.txt | 1 + src/WalterEgo.Core/WalterEgo.Core.csproj | 12 + src/WalterEgo.Core/packages.lock.json | 31 +++ .../PublicAPI.Shipped.txt | 1 + .../PublicAPI.Unshipped.txt | 1 + .../WalterEgo.EntityFrameworkCore.csproj | 15 ++ .../packages.lock.json | 28 +++ .../PublicAPI.Shipped.txt | 1 + .../PublicAPI.Unshipped.txt | 1 + .../WalterEgo.Generators.csproj | 15 ++ src/WalterEgo.Generators/packages.lock.json | 28 +++ tests/Directory.Build.props | 19 ++ .../PackageIdentityTests.cs | 29 +++ .../WalterEgo.Alerting.Webhook.Tests.csproj | 7 + .../packages.lock.json | 213 +++++++++++++++++ .../PackageIdentityTests.cs | 29 +++ ...WalterEgo.AspNetCore.Identity.Tests.csproj | 7 + .../packages.lock.json | 219 ++++++++++++++++++ .../PackageIdentityTests.cs | 29 +++ .../WalterEgo.AspNetCore.Tests.csproj | 7 + .../packages.lock.json | 213 +++++++++++++++++ tests/WalterEgo.Benchmarks/Program.cs | 3 + .../WalterEgo.Benchmarks.csproj | 11 + tests/WalterEgo.Benchmarks/packages.lock.json | 177 ++++++++++++++ .../PackageIdentityTests.cs | 29 +++ .../WalterEgo.Cli.Tests.csproj | 7 + tests/WalterEgo.Cli.Tests/packages.lock.json | 219 ++++++++++++++++++ .../PackageIdentityTests.cs | 29 +++ .../WalterEgo.Core.Tests.csproj | 7 + tests/WalterEgo.Core.Tests/packages.lock.json | 207 +++++++++++++++++ .../PackageIdentityTests.cs | 29 +++ ...WalterEgo.EntityFrameworkCore.Tests.csproj | 7 + .../packages.lock.json | 213 +++++++++++++++++ .../PackageIdentityTests.cs | 29 +++ .../WalterEgo.Generators.Tests.csproj | 7 + .../packages.lock.json | 213 +++++++++++++++++ 65 files changed, 2569 insertions(+) create mode 100644 .editorconfig create mode 100644 Directory.Build.props create mode 100644 Directory.Packages.props create mode 100644 WalterEgo.slnx create mode 100644 eng/BannedSymbols.txt create mode 100644 global.json create mode 100644 nuget.config create mode 100644 samples/WalterEgo.Samples.MinimalApi/Program.cs create mode 100644 samples/WalterEgo.Samples.MinimalApi/WalterEgo.Samples.MinimalApi.csproj create mode 100644 samples/WalterEgo.Samples.MinimalApi/packages.lock.json create mode 100644 src/Directory.Build.props create mode 100644 src/WalterEgo.Alerting.Webhook/PublicAPI.Shipped.txt create mode 100644 src/WalterEgo.Alerting.Webhook/PublicAPI.Unshipped.txt create mode 100644 src/WalterEgo.Alerting.Webhook/WalterEgo.Alerting.Webhook.csproj create mode 100644 src/WalterEgo.Alerting.Webhook/packages.lock.json create mode 100644 src/WalterEgo.AspNetCore.Identity/PublicAPI.Shipped.txt create mode 100644 src/WalterEgo.AspNetCore.Identity/PublicAPI.Unshipped.txt create mode 100644 src/WalterEgo.AspNetCore.Identity/WalterEgo.AspNetCore.Identity.csproj create mode 100644 src/WalterEgo.AspNetCore.Identity/packages.lock.json create mode 100644 src/WalterEgo.AspNetCore/PublicAPI.Shipped.txt create mode 100644 src/WalterEgo.AspNetCore/PublicAPI.Unshipped.txt create mode 100644 src/WalterEgo.AspNetCore/WalterEgo.AspNetCore.csproj create mode 100644 src/WalterEgo.AspNetCore/packages.lock.json create mode 100644 src/WalterEgo.Cli/Program.cs create mode 100644 src/WalterEgo.Cli/PublicAPI.Shipped.txt create mode 100644 src/WalterEgo.Cli/PublicAPI.Unshipped.txt create mode 100644 src/WalterEgo.Cli/WalterEgo.Cli.csproj create mode 100644 src/WalterEgo.Cli/packages.lock.json create mode 100644 src/WalterEgo.Core/PublicAPI.Shipped.txt create mode 100644 src/WalterEgo.Core/PublicAPI.Unshipped.txt create mode 100644 src/WalterEgo.Core/WalterEgo.Core.csproj create mode 100644 src/WalterEgo.Core/packages.lock.json create mode 100644 src/WalterEgo.EntityFrameworkCore/PublicAPI.Shipped.txt create mode 100644 src/WalterEgo.EntityFrameworkCore/PublicAPI.Unshipped.txt create mode 100644 src/WalterEgo.EntityFrameworkCore/WalterEgo.EntityFrameworkCore.csproj create mode 100644 src/WalterEgo.EntityFrameworkCore/packages.lock.json create mode 100644 src/WalterEgo.Generators/PublicAPI.Shipped.txt create mode 100644 src/WalterEgo.Generators/PublicAPI.Unshipped.txt create mode 100644 src/WalterEgo.Generators/WalterEgo.Generators.csproj create mode 100644 src/WalterEgo.Generators/packages.lock.json create mode 100644 tests/Directory.Build.props create mode 100644 tests/WalterEgo.Alerting.Webhook.Tests/PackageIdentityTests.cs create mode 100644 tests/WalterEgo.Alerting.Webhook.Tests/WalterEgo.Alerting.Webhook.Tests.csproj create mode 100644 tests/WalterEgo.Alerting.Webhook.Tests/packages.lock.json create mode 100644 tests/WalterEgo.AspNetCore.Identity.Tests/PackageIdentityTests.cs create mode 100644 tests/WalterEgo.AspNetCore.Identity.Tests/WalterEgo.AspNetCore.Identity.Tests.csproj create mode 100644 tests/WalterEgo.AspNetCore.Identity.Tests/packages.lock.json create mode 100644 tests/WalterEgo.AspNetCore.Tests/PackageIdentityTests.cs create mode 100644 tests/WalterEgo.AspNetCore.Tests/WalterEgo.AspNetCore.Tests.csproj create mode 100644 tests/WalterEgo.AspNetCore.Tests/packages.lock.json create mode 100644 tests/WalterEgo.Benchmarks/Program.cs create mode 100644 tests/WalterEgo.Benchmarks/WalterEgo.Benchmarks.csproj create mode 100644 tests/WalterEgo.Benchmarks/packages.lock.json create mode 100644 tests/WalterEgo.Cli.Tests/PackageIdentityTests.cs create mode 100644 tests/WalterEgo.Cli.Tests/WalterEgo.Cli.Tests.csproj create mode 100644 tests/WalterEgo.Cli.Tests/packages.lock.json create mode 100644 tests/WalterEgo.Core.Tests/PackageIdentityTests.cs create mode 100644 tests/WalterEgo.Core.Tests/WalterEgo.Core.Tests.csproj create mode 100644 tests/WalterEgo.Core.Tests/packages.lock.json create mode 100644 tests/WalterEgo.EntityFrameworkCore.Tests/PackageIdentityTests.cs create mode 100644 tests/WalterEgo.EntityFrameworkCore.Tests/WalterEgo.EntityFrameworkCore.Tests.csproj create mode 100644 tests/WalterEgo.EntityFrameworkCore.Tests/packages.lock.json create mode 100644 tests/WalterEgo.Generators.Tests/PackageIdentityTests.cs create mode 100644 tests/WalterEgo.Generators.Tests/WalterEgo.Generators.Tests.csproj create mode 100644 tests/WalterEgo.Generators.Tests/packages.lock.json diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..adb4875 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,65 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +insert_final_newline = true +indent_style = space +indent_size = 4 +trim_trailing_whitespace = true + +[*.{json,yml,yaml,props,targets,csproj,slnx,xml,config}] +indent_size = 2 + +[*.md] +trim_trailing_whitespace = false + +[*.cs] +# Namespaces and usings +csharp_style_namespace_declarations = file_scoped:warning +dotnet_sort_system_directives_first = true +dotnet_separate_import_directive_groups = false +dotnet_diagnostic.IDE0005.severity = warning +dotnet_diagnostic.IDE0161.severity = warning + +# Language preferences +csharp_style_var_for_built_in_types = true:suggestion +csharp_style_var_when_type_is_apparent = true:suggestion +csharp_style_var_elsewhere = false:suggestion +csharp_style_expression_bodied_methods = when_on_single_line:suggestion +csharp_style_expression_bodied_properties = true:suggestion +csharp_prefer_braces = when_multiline:suggestion +csharp_style_prefer_primary_constructors = true:suggestion +dotnet_style_prefer_collection_expression = when_types_loosely_match:suggestion +csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion +dotnet_style_readonly_field = true:warning + +# Naming +dotnet_naming_rule.private_fields_underscore.symbols = private_fields +dotnet_naming_rule.private_fields_underscore.style = underscore_camel +dotnet_naming_rule.private_fields_underscore.severity = warning +dotnet_naming_symbols.private_fields.applicable_kinds = field +dotnet_naming_symbols.private_fields.applicable_accessibilities = private +dotnet_naming_style.underscore_camel.required_prefix = _ +dotnet_naming_style.underscore_camel.capitalization = camel_case + +dotnet_naming_rule.private_static_readonly.symbols = private_static_readonly_fields +dotnet_naming_rule.private_static_readonly.style = pascal_case +dotnet_naming_rule.private_static_readonly.severity = warning +dotnet_naming_symbols.private_static_readonly_fields.applicable_kinds = field +dotnet_naming_symbols.private_static_readonly_fields.applicable_accessibilities = private +dotnet_naming_symbols.private_static_readonly_fields.required_modifiers = static, readonly +dotnet_naming_style.pascal_case.capitalization = pascal_case + +dotnet_naming_rule.private_const.symbols = private_const_fields +dotnet_naming_rule.private_const.style = pascal_case +dotnet_naming_rule.private_const.severity = warning +dotnet_naming_symbols.private_const_fields.applicable_kinds = field +dotnet_naming_symbols.private_const_fields.applicable_accessibilities = private +dotnet_naming_symbols.private_const_fields.required_modifiers = const + +[tests/**.cs] +# Test names describe behavior with underscores for readability. +dotnet_diagnostic.CA1707.severity = none +# Test classes and members are not part of any public contract, so they carry no XML docs. +dotnet_diagnostic.CS1591.severity = none diff --git a/Directory.Build.props b/Directory.Build.props new file mode 100644 index 0000000..5d5eaea --- /dev/null +++ b/Directory.Build.props @@ -0,0 +1,48 @@ + + + net10.0 + 14 + enable + enable + true + true + latest-Recommended + true + true + false + + false + + + + true + + true + all + low + + + + true + true + + + + v + 0.1 + + + + ScriptRunnerKit + Copyright (c) 2026 ScriptRunnerKit contributors + MIT + https://github.com/ScriptRunnerKit/WalterEgo + https://github.com/ScriptRunnerKit/WalterEgo + git + true + true + true + snupkg + honeytoken;deception;canary;security;aspnetcore;efcore + + diff --git a/Directory.Packages.props b/Directory.Packages.props new file mode 100644 index 0000000..366317d --- /dev/null +++ b/Directory.Packages.props @@ -0,0 +1,18 @@ + + + true + + + + + + + + + + + + + + + diff --git a/WalterEgo.slnx b/WalterEgo.slnx new file mode 100644 index 0000000..675f801 --- /dev/null +++ b/WalterEgo.slnx @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/eng/BannedSymbols.txt b/eng/BannedSymbols.txt new file mode 100644 index 0000000..cf4b909 --- /dev/null +++ b/eng/BannedSymbols.txt @@ -0,0 +1,28 @@ +P:System.DateTime.Now; Use TimeProvider +P:System.DateTime.UtcNow; Use TimeProvider +P:System.DateTimeOffset.Now; Use TimeProvider +P:System.DateTimeOffset.UtcNow; Use TimeProvider +M:System.Net.Http.HttpClient.#ctor; Use IHttpClientFactory +M:System.Net.Http.HttpClient.#ctor(System.Net.Http.HttpMessageHandler); Use IHttpClientFactory +M:System.Net.Http.HttpClient.#ctor(System.Net.Http.HttpMessageHandler,System.Boolean); Use IHttpClientFactory +M:System.Threading.Tasks.Task.Wait; Await the task instead +M:System.Threading.Tasks.Task.Wait(System.Int32); Await the task instead +M:System.Threading.Tasks.Task.Wait(System.TimeSpan); Await the task instead +M:System.Threading.Tasks.Task.Wait(System.Threading.CancellationToken); Await the task instead +M:System.Threading.Tasks.Task.Wait(System.Int32,System.Threading.CancellationToken); Await the task instead +M:System.Threading.Tasks.Task.Wait(System.TimeSpan,System.Threading.CancellationToken); Await the task instead +M:System.Threading.Tasks.Task.WaitAll(System.Threading.Tasks.Task[]); Use Task.WhenAll +M:System.Threading.Tasks.Task.WaitAll(System.Threading.Tasks.Task[],System.Int32); Use Task.WhenAll +M:System.Threading.Tasks.Task.WaitAll(System.Threading.Tasks.Task[],System.TimeSpan); Use Task.WhenAll +M:System.Threading.Tasks.Task.WaitAll(System.Threading.Tasks.Task[],System.Threading.CancellationToken); Use Task.WhenAll +M:System.Threading.Tasks.Task.WaitAll(System.Threading.Tasks.Task[],System.Int32,System.Threading.CancellationToken); Use Task.WhenAll +M:System.Threading.Tasks.Task.WaitAll(System.Collections.Generic.IEnumerable{System.Threading.Tasks.Task},System.Threading.CancellationToken); Use Task.WhenAll +M:System.Threading.Tasks.Task.WaitAll(System.ReadOnlySpan{System.Threading.Tasks.Task}); Use Task.WhenAll +P:System.Threading.Tasks.Task`1.Result; Await the task instead +T:System.Console; Libraries never write to the console; use ILogger +T:System.Random; Use RandomNumberGenerator, decoy values must come from a CSPRNG +M:System.GC.Collect; Let the runtime manage collections +M:System.GC.Collect(System.Int32); Let the runtime manage collections +M:System.GC.Collect(System.Int32,System.GCCollectionMode); Let the runtime manage collections +M:System.GC.Collect(System.Int32,System.GCCollectionMode,System.Boolean); Let the runtime manage collections +M:System.GC.Collect(System.Int32,System.GCCollectionMode,System.Boolean,System.Boolean); Let the runtime manage collections diff --git a/global.json b/global.json new file mode 100644 index 0000000..81271f8 --- /dev/null +++ b/global.json @@ -0,0 +1,9 @@ +{ + "sdk": { + "version": "10.0.400", + "rollForward": "disable" + }, + "test": { + "runner": "Microsoft.Testing.Platform" + } +} diff --git a/nuget.config b/nuget.config new file mode 100644 index 0000000..4e800bf --- /dev/null +++ b/nuget.config @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/samples/WalterEgo.Samples.MinimalApi/Program.cs b/samples/WalterEgo.Samples.MinimalApi/Program.cs new file mode 100644 index 0000000..3383ac1 --- /dev/null +++ b/samples/WalterEgo.Samples.MinimalApi/Program.cs @@ -0,0 +1,5 @@ +var builder = WebApplication.CreateBuilder(args); + +var app = builder.Build(); + +app.Run(); diff --git a/samples/WalterEgo.Samples.MinimalApi/WalterEgo.Samples.MinimalApi.csproj b/samples/WalterEgo.Samples.MinimalApi/WalterEgo.Samples.MinimalApi.csproj new file mode 100644 index 0000000..18153b4 --- /dev/null +++ b/samples/WalterEgo.Samples.MinimalApi/WalterEgo.Samples.MinimalApi.csproj @@ -0,0 +1,7 @@ + + + + + + + diff --git a/samples/WalterEgo.Samples.MinimalApi/packages.lock.json b/samples/WalterEgo.Samples.MinimalApi/packages.lock.json new file mode 100644 index 0000000..bd7f815 --- /dev/null +++ b/samples/WalterEgo.Samples.MinimalApi/packages.lock.json @@ -0,0 +1,22 @@ +{ + "version": 2, + "dependencies": { + "net10.0": { + "MinVer": { + "type": "Direct", + "requested": "[8.0.0, )", + "resolved": "8.0.0", + "contentHash": "AJy/KVjXgUbgjf6HiI8wAk4DSSq0SCmvXQF8aU6IB+pnIQq+YJvofvMczug2hqO8yEvnQY557ryew66KPpyCsA==" + }, + "walterego.aspnetcore": { + "type": "Project", + "dependencies": { + "WalterEgo.Core": "[1.0.0, )" + } + }, + "walterego.core": { + "type": "Project" + } + } + } +} \ No newline at end of file diff --git a/src/Directory.Build.props b/src/Directory.Build.props new file mode 100644 index 0000000..1abbc67 --- /dev/null +++ b/src/Directory.Build.props @@ -0,0 +1,19 @@ + + + + + true + true + + + + + + + + + + + + + diff --git a/src/WalterEgo.Alerting.Webhook/PublicAPI.Shipped.txt b/src/WalterEgo.Alerting.Webhook/PublicAPI.Shipped.txt new file mode 100644 index 0000000..7dc5c58 --- /dev/null +++ b/src/WalterEgo.Alerting.Webhook/PublicAPI.Shipped.txt @@ -0,0 +1 @@ +#nullable enable diff --git a/src/WalterEgo.Alerting.Webhook/PublicAPI.Unshipped.txt b/src/WalterEgo.Alerting.Webhook/PublicAPI.Unshipped.txt new file mode 100644 index 0000000..7dc5c58 --- /dev/null +++ b/src/WalterEgo.Alerting.Webhook/PublicAPI.Unshipped.txt @@ -0,0 +1 @@ +#nullable enable diff --git a/src/WalterEgo.Alerting.Webhook/WalterEgo.Alerting.Webhook.csproj b/src/WalterEgo.Alerting.Webhook/WalterEgo.Alerting.Webhook.csproj new file mode 100644 index 0000000..d3be921 --- /dev/null +++ b/src/WalterEgo.Alerting.Webhook/WalterEgo.Alerting.Webhook.csproj @@ -0,0 +1,16 @@ + + + + Signed webhook alert channel for WalterEgo. + true + + + + + + + + + + + diff --git a/src/WalterEgo.Alerting.Webhook/packages.lock.json b/src/WalterEgo.Alerting.Webhook/packages.lock.json new file mode 100644 index 0000000..c243c40 --- /dev/null +++ b/src/WalterEgo.Alerting.Webhook/packages.lock.json @@ -0,0 +1,34 @@ +{ + "version": 2, + "dependencies": { + "net10.0": { + "Microsoft.CodeAnalysis.BannedApiAnalyzers": { + "type": "Direct", + "requested": "[5.6.0, )", + "resolved": "5.6.0", + "contentHash": "Kcobt3pnOdO0A+6CKiMHZdTEluJpsfxiV20axtZdmfBQnDmiWTKPJADlgAfdTuKNAnVarrkJa0UEGwuOo91muw==" + }, + "Microsoft.CodeAnalysis.PublicApiAnalyzers": { + "type": "Direct", + "requested": "[5.6.0, )", + "resolved": "5.6.0", + "contentHash": "W4kJGezNIKLzo0Ak5FAQDFvkMf2U7DtGL4THmHyRSApfKsKt5V+eX/bU0ZLKAt/uf9Bb2o1bi0YDKj/GRB/vYQ==" + }, + "Microsoft.NET.ILLink.Tasks": { + "type": "Direct", + "requested": "[10.0.11, )", + "resolved": "10.0.11", + "contentHash": "IBf7lbovvjGWVWXZX5cJ/cO0WXbId0Zq4BuSeT94mGZuOAP66oMeH9PTBZ9Jpp3Jb6jtK0qm/NyUbPRo1gC/wQ==" + }, + "MinVer": { + "type": "Direct", + "requested": "[8.0.0, )", + "resolved": "8.0.0", + "contentHash": "AJy/KVjXgUbgjf6HiI8wAk4DSSq0SCmvXQF8aU6IB+pnIQq+YJvofvMczug2hqO8yEvnQY557ryew66KPpyCsA==" + }, + "walterego.core": { + "type": "Project" + } + } + } +} \ No newline at end of file diff --git a/src/WalterEgo.AspNetCore.Identity/PublicAPI.Shipped.txt b/src/WalterEgo.AspNetCore.Identity/PublicAPI.Shipped.txt new file mode 100644 index 0000000..7dc5c58 --- /dev/null +++ b/src/WalterEgo.AspNetCore.Identity/PublicAPI.Shipped.txt @@ -0,0 +1 @@ +#nullable enable diff --git a/src/WalterEgo.AspNetCore.Identity/PublicAPI.Unshipped.txt b/src/WalterEgo.AspNetCore.Identity/PublicAPI.Unshipped.txt new file mode 100644 index 0000000..7dc5c58 --- /dev/null +++ b/src/WalterEgo.AspNetCore.Identity/PublicAPI.Unshipped.txt @@ -0,0 +1 @@ +#nullable enable diff --git a/src/WalterEgo.AspNetCore.Identity/WalterEgo.AspNetCore.Identity.csproj b/src/WalterEgo.AspNetCore.Identity/WalterEgo.AspNetCore.Identity.csproj new file mode 100644 index 0000000..63e2154 --- /dev/null +++ b/src/WalterEgo.AspNetCore.Identity/WalterEgo.AspNetCore.Identity.csproj @@ -0,0 +1,16 @@ + + + + ASP.NET Core Identity integration for WalterEgo honey users. + true + + + + + + + + + + + diff --git a/src/WalterEgo.AspNetCore.Identity/packages.lock.json b/src/WalterEgo.AspNetCore.Identity/packages.lock.json new file mode 100644 index 0000000..62117d7 --- /dev/null +++ b/src/WalterEgo.AspNetCore.Identity/packages.lock.json @@ -0,0 +1,40 @@ +{ + "version": 2, + "dependencies": { + "net10.0": { + "Microsoft.CodeAnalysis.BannedApiAnalyzers": { + "type": "Direct", + "requested": "[5.6.0, )", + "resolved": "5.6.0", + "contentHash": "Kcobt3pnOdO0A+6CKiMHZdTEluJpsfxiV20axtZdmfBQnDmiWTKPJADlgAfdTuKNAnVarrkJa0UEGwuOo91muw==" + }, + "Microsoft.CodeAnalysis.PublicApiAnalyzers": { + "type": "Direct", + "requested": "[5.6.0, )", + "resolved": "5.6.0", + "contentHash": "W4kJGezNIKLzo0Ak5FAQDFvkMf2U7DtGL4THmHyRSApfKsKt5V+eX/bU0ZLKAt/uf9Bb2o1bi0YDKj/GRB/vYQ==" + }, + "Microsoft.NET.ILLink.Tasks": { + "type": "Direct", + "requested": "[10.0.11, )", + "resolved": "10.0.11", + "contentHash": "IBf7lbovvjGWVWXZX5cJ/cO0WXbId0Zq4BuSeT94mGZuOAP66oMeH9PTBZ9Jpp3Jb6jtK0qm/NyUbPRo1gC/wQ==" + }, + "MinVer": { + "type": "Direct", + "requested": "[8.0.0, )", + "resolved": "8.0.0", + "contentHash": "AJy/KVjXgUbgjf6HiI8wAk4DSSq0SCmvXQF8aU6IB+pnIQq+YJvofvMczug2hqO8yEvnQY557ryew66KPpyCsA==" + }, + "walterego.aspnetcore": { + "type": "Project", + "dependencies": { + "WalterEgo.Core": "[1.0.0, )" + } + }, + "walterego.core": { + "type": "Project" + } + } + } +} \ No newline at end of file diff --git a/src/WalterEgo.AspNetCore/PublicAPI.Shipped.txt b/src/WalterEgo.AspNetCore/PublicAPI.Shipped.txt new file mode 100644 index 0000000..7dc5c58 --- /dev/null +++ b/src/WalterEgo.AspNetCore/PublicAPI.Shipped.txt @@ -0,0 +1 @@ +#nullable enable diff --git a/src/WalterEgo.AspNetCore/PublicAPI.Unshipped.txt b/src/WalterEgo.AspNetCore/PublicAPI.Unshipped.txt new file mode 100644 index 0000000..7dc5c58 --- /dev/null +++ b/src/WalterEgo.AspNetCore/PublicAPI.Unshipped.txt @@ -0,0 +1 @@ +#nullable enable diff --git a/src/WalterEgo.AspNetCore/WalterEgo.AspNetCore.csproj b/src/WalterEgo.AspNetCore/WalterEgo.AspNetCore.csproj new file mode 100644 index 0000000..d129500 --- /dev/null +++ b/src/WalterEgo.AspNetCore/WalterEgo.AspNetCore.csproj @@ -0,0 +1,16 @@ + + + + ASP.NET Core sensors for WalterEgo honeytokens. + true + + + + + + + + + + + diff --git a/src/WalterEgo.AspNetCore/packages.lock.json b/src/WalterEgo.AspNetCore/packages.lock.json new file mode 100644 index 0000000..c243c40 --- /dev/null +++ b/src/WalterEgo.AspNetCore/packages.lock.json @@ -0,0 +1,34 @@ +{ + "version": 2, + "dependencies": { + "net10.0": { + "Microsoft.CodeAnalysis.BannedApiAnalyzers": { + "type": "Direct", + "requested": "[5.6.0, )", + "resolved": "5.6.0", + "contentHash": "Kcobt3pnOdO0A+6CKiMHZdTEluJpsfxiV20axtZdmfBQnDmiWTKPJADlgAfdTuKNAnVarrkJa0UEGwuOo91muw==" + }, + "Microsoft.CodeAnalysis.PublicApiAnalyzers": { + "type": "Direct", + "requested": "[5.6.0, )", + "resolved": "5.6.0", + "contentHash": "W4kJGezNIKLzo0Ak5FAQDFvkMf2U7DtGL4THmHyRSApfKsKt5V+eX/bU0ZLKAt/uf9Bb2o1bi0YDKj/GRB/vYQ==" + }, + "Microsoft.NET.ILLink.Tasks": { + "type": "Direct", + "requested": "[10.0.11, )", + "resolved": "10.0.11", + "contentHash": "IBf7lbovvjGWVWXZX5cJ/cO0WXbId0Zq4BuSeT94mGZuOAP66oMeH9PTBZ9Jpp3Jb6jtK0qm/NyUbPRo1gC/wQ==" + }, + "MinVer": { + "type": "Direct", + "requested": "[8.0.0, )", + "resolved": "8.0.0", + "contentHash": "AJy/KVjXgUbgjf6HiI8wAk4DSSq0SCmvXQF8aU6IB+pnIQq+YJvofvMczug2hqO8yEvnQY557ryew66KPpyCsA==" + }, + "walterego.core": { + "type": "Project" + } + } + } +} \ No newline at end of file diff --git a/src/WalterEgo.Cli/Program.cs b/src/WalterEgo.Cli/Program.cs new file mode 100644 index 0000000..51bb64e --- /dev/null +++ b/src/WalterEgo.Cli/Program.cs @@ -0,0 +1 @@ +return 0; diff --git a/src/WalterEgo.Cli/PublicAPI.Shipped.txt b/src/WalterEgo.Cli/PublicAPI.Shipped.txt new file mode 100644 index 0000000..7dc5c58 --- /dev/null +++ b/src/WalterEgo.Cli/PublicAPI.Shipped.txt @@ -0,0 +1 @@ +#nullable enable diff --git a/src/WalterEgo.Cli/PublicAPI.Unshipped.txt b/src/WalterEgo.Cli/PublicAPI.Unshipped.txt new file mode 100644 index 0000000..7dc5c58 --- /dev/null +++ b/src/WalterEgo.Cli/PublicAPI.Unshipped.txt @@ -0,0 +1 @@ +#nullable enable diff --git a/src/WalterEgo.Cli/WalterEgo.Cli.csproj b/src/WalterEgo.Cli/WalterEgo.Cli.csproj new file mode 100644 index 0000000..af2f6e0 --- /dev/null +++ b/src/WalterEgo.Cli/WalterEgo.Cli.csproj @@ -0,0 +1,18 @@ + + + + The walterego command-line tool: generate, validate and test honeytokens. + Exe + true + walterego + + + + + + + + + + + diff --git a/src/WalterEgo.Cli/packages.lock.json b/src/WalterEgo.Cli/packages.lock.json new file mode 100644 index 0000000..89c6d2b --- /dev/null +++ b/src/WalterEgo.Cli/packages.lock.json @@ -0,0 +1,34 @@ +{ + "version": 2, + "dependencies": { + "net10.0": { + "Microsoft.CodeAnalysis.BannedApiAnalyzers": { + "type": "Direct", + "requested": "[5.6.0, )", + "resolved": "5.6.0", + "contentHash": "Kcobt3pnOdO0A+6CKiMHZdTEluJpsfxiV20axtZdmfBQnDmiWTKPJADlgAfdTuKNAnVarrkJa0UEGwuOo91muw==" + }, + "Microsoft.CodeAnalysis.PublicApiAnalyzers": { + "type": "Direct", + "requested": "[5.6.0, )", + "resolved": "5.6.0", + "contentHash": "W4kJGezNIKLzo0Ak5FAQDFvkMf2U7DtGL4THmHyRSApfKsKt5V+eX/bU0ZLKAt/uf9Bb2o1bi0YDKj/GRB/vYQ==" + }, + "MinVer": { + "type": "Direct", + "requested": "[8.0.0, )", + "resolved": "8.0.0", + "contentHash": "AJy/KVjXgUbgjf6HiI8wAk4DSSq0SCmvXQF8aU6IB+pnIQq+YJvofvMczug2hqO8yEvnQY557ryew66KPpyCsA==" + }, + "walterego.core": { + "type": "Project" + }, + "walterego.generators": { + "type": "Project", + "dependencies": { + "WalterEgo.Core": "[1.0.0, )" + } + } + } + } +} \ No newline at end of file diff --git a/src/WalterEgo.Core/PublicAPI.Shipped.txt b/src/WalterEgo.Core/PublicAPI.Shipped.txt new file mode 100644 index 0000000..7dc5c58 --- /dev/null +++ b/src/WalterEgo.Core/PublicAPI.Shipped.txt @@ -0,0 +1 @@ +#nullable enable diff --git a/src/WalterEgo.Core/PublicAPI.Unshipped.txt b/src/WalterEgo.Core/PublicAPI.Unshipped.txt new file mode 100644 index 0000000..7dc5c58 --- /dev/null +++ b/src/WalterEgo.Core/PublicAPI.Unshipped.txt @@ -0,0 +1 @@ +#nullable enable diff --git a/src/WalterEgo.Core/WalterEgo.Core.csproj b/src/WalterEgo.Core/WalterEgo.Core.csproj new file mode 100644 index 0000000..82586b0 --- /dev/null +++ b/src/WalterEgo.Core/WalterEgo.Core.csproj @@ -0,0 +1,12 @@ + + + + Core of WalterEgo: honeytoken model, registry, trip pipeline and alert dispatching. + true + + + + + + + diff --git a/src/WalterEgo.Core/packages.lock.json b/src/WalterEgo.Core/packages.lock.json new file mode 100644 index 0000000..38f8ba9 --- /dev/null +++ b/src/WalterEgo.Core/packages.lock.json @@ -0,0 +1,31 @@ +{ + "version": 2, + "dependencies": { + "net10.0": { + "Microsoft.CodeAnalysis.BannedApiAnalyzers": { + "type": "Direct", + "requested": "[5.6.0, )", + "resolved": "5.6.0", + "contentHash": "Kcobt3pnOdO0A+6CKiMHZdTEluJpsfxiV20axtZdmfBQnDmiWTKPJADlgAfdTuKNAnVarrkJa0UEGwuOo91muw==" + }, + "Microsoft.CodeAnalysis.PublicApiAnalyzers": { + "type": "Direct", + "requested": "[5.6.0, )", + "resolved": "5.6.0", + "contentHash": "W4kJGezNIKLzo0Ak5FAQDFvkMf2U7DtGL4THmHyRSApfKsKt5V+eX/bU0ZLKAt/uf9Bb2o1bi0YDKj/GRB/vYQ==" + }, + "Microsoft.NET.ILLink.Tasks": { + "type": "Direct", + "requested": "[10.0.11, )", + "resolved": "10.0.11", + "contentHash": "IBf7lbovvjGWVWXZX5cJ/cO0WXbId0Zq4BuSeT94mGZuOAP66oMeH9PTBZ9Jpp3Jb6jtK0qm/NyUbPRo1gC/wQ==" + }, + "MinVer": { + "type": "Direct", + "requested": "[8.0.0, )", + "resolved": "8.0.0", + "contentHash": "AJy/KVjXgUbgjf6HiI8wAk4DSSq0SCmvXQF8aU6IB+pnIQq+YJvofvMczug2hqO8yEvnQY557ryew66KPpyCsA==" + } + } + } +} \ No newline at end of file diff --git a/src/WalterEgo.EntityFrameworkCore/PublicAPI.Shipped.txt b/src/WalterEgo.EntityFrameworkCore/PublicAPI.Shipped.txt new file mode 100644 index 0000000..7dc5c58 --- /dev/null +++ b/src/WalterEgo.EntityFrameworkCore/PublicAPI.Shipped.txt @@ -0,0 +1 @@ +#nullable enable diff --git a/src/WalterEgo.EntityFrameworkCore/PublicAPI.Unshipped.txt b/src/WalterEgo.EntityFrameworkCore/PublicAPI.Unshipped.txt new file mode 100644 index 0000000..7dc5c58 --- /dev/null +++ b/src/WalterEgo.EntityFrameworkCore/PublicAPI.Unshipped.txt @@ -0,0 +1 @@ +#nullable enable diff --git a/src/WalterEgo.EntityFrameworkCore/WalterEgo.EntityFrameworkCore.csproj b/src/WalterEgo.EntityFrameworkCore/WalterEgo.EntityFrameworkCore.csproj new file mode 100644 index 0000000..d8682dd --- /dev/null +++ b/src/WalterEgo.EntityFrameworkCore/WalterEgo.EntityFrameworkCore.csproj @@ -0,0 +1,15 @@ + + + + Entity Framework Core integration for WalterEgo honey rows. + + + + + + + + + + + diff --git a/src/WalterEgo.EntityFrameworkCore/packages.lock.json b/src/WalterEgo.EntityFrameworkCore/packages.lock.json new file mode 100644 index 0000000..579ff87 --- /dev/null +++ b/src/WalterEgo.EntityFrameworkCore/packages.lock.json @@ -0,0 +1,28 @@ +{ + "version": 2, + "dependencies": { + "net10.0": { + "Microsoft.CodeAnalysis.BannedApiAnalyzers": { + "type": "Direct", + "requested": "[5.6.0, )", + "resolved": "5.6.0", + "contentHash": "Kcobt3pnOdO0A+6CKiMHZdTEluJpsfxiV20axtZdmfBQnDmiWTKPJADlgAfdTuKNAnVarrkJa0UEGwuOo91muw==" + }, + "Microsoft.CodeAnalysis.PublicApiAnalyzers": { + "type": "Direct", + "requested": "[5.6.0, )", + "resolved": "5.6.0", + "contentHash": "W4kJGezNIKLzo0Ak5FAQDFvkMf2U7DtGL4THmHyRSApfKsKt5V+eX/bU0ZLKAt/uf9Bb2o1bi0YDKj/GRB/vYQ==" + }, + "MinVer": { + "type": "Direct", + "requested": "[8.0.0, )", + "resolved": "8.0.0", + "contentHash": "AJy/KVjXgUbgjf6HiI8wAk4DSSq0SCmvXQF8aU6IB+pnIQq+YJvofvMczug2hqO8yEvnQY557ryew66KPpyCsA==" + }, + "walterego.core": { + "type": "Project" + } + } + } +} \ No newline at end of file diff --git a/src/WalterEgo.Generators/PublicAPI.Shipped.txt b/src/WalterEgo.Generators/PublicAPI.Shipped.txt new file mode 100644 index 0000000..7dc5c58 --- /dev/null +++ b/src/WalterEgo.Generators/PublicAPI.Shipped.txt @@ -0,0 +1 @@ +#nullable enable diff --git a/src/WalterEgo.Generators/PublicAPI.Unshipped.txt b/src/WalterEgo.Generators/PublicAPI.Unshipped.txt new file mode 100644 index 0000000..7dc5c58 --- /dev/null +++ b/src/WalterEgo.Generators/PublicAPI.Unshipped.txt @@ -0,0 +1 @@ +#nullable enable diff --git a/src/WalterEgo.Generators/WalterEgo.Generators.csproj b/src/WalterEgo.Generators/WalterEgo.Generators.csproj new file mode 100644 index 0000000..56d8942 --- /dev/null +++ b/src/WalterEgo.Generators/WalterEgo.Generators.csproj @@ -0,0 +1,15 @@ + + + + Generators of plausible decoy values for WalterEgo. + + + + + + + + + + + diff --git a/src/WalterEgo.Generators/packages.lock.json b/src/WalterEgo.Generators/packages.lock.json new file mode 100644 index 0000000..579ff87 --- /dev/null +++ b/src/WalterEgo.Generators/packages.lock.json @@ -0,0 +1,28 @@ +{ + "version": 2, + "dependencies": { + "net10.0": { + "Microsoft.CodeAnalysis.BannedApiAnalyzers": { + "type": "Direct", + "requested": "[5.6.0, )", + "resolved": "5.6.0", + "contentHash": "Kcobt3pnOdO0A+6CKiMHZdTEluJpsfxiV20axtZdmfBQnDmiWTKPJADlgAfdTuKNAnVarrkJa0UEGwuOo91muw==" + }, + "Microsoft.CodeAnalysis.PublicApiAnalyzers": { + "type": "Direct", + "requested": "[5.6.0, )", + "resolved": "5.6.0", + "contentHash": "W4kJGezNIKLzo0Ak5FAQDFvkMf2U7DtGL4THmHyRSApfKsKt5V+eX/bU0ZLKAt/uf9Bb2o1bi0YDKj/GRB/vYQ==" + }, + "MinVer": { + "type": "Direct", + "requested": "[8.0.0, )", + "resolved": "8.0.0", + "contentHash": "AJy/KVjXgUbgjf6HiI8wAk4DSSq0SCmvXQF8aU6IB+pnIQq+YJvofvMczug2hqO8yEvnQY557ryew66KPpyCsA==" + }, + "walterego.core": { + "type": "Project" + } + } + } +} \ No newline at end of file diff --git a/tests/Directory.Build.props b/tests/Directory.Build.props new file mode 100644 index 0000000..52eced4 --- /dev/null +++ b/tests/Directory.Build.props @@ -0,0 +1,19 @@ + + + + + Exe + true + + + + + + + + + + + + + diff --git a/tests/WalterEgo.Alerting.Webhook.Tests/PackageIdentityTests.cs b/tests/WalterEgo.Alerting.Webhook.Tests/PackageIdentityTests.cs new file mode 100644 index 0000000..f4ddafc --- /dev/null +++ b/tests/WalterEgo.Alerting.Webhook.Tests/PackageIdentityTests.cs @@ -0,0 +1,29 @@ +using System.Reflection; +using System.Text.RegularExpressions; + +namespace WalterEgo.Alerting.Webhook.Tests; + +public sealed partial class PackageIdentityTests +{ + private const string PackageId = "WalterEgo.Alerting.Webhook"; + + private static readonly Assembly PackageAssembly = Assembly.Load(PackageId); + + [Fact] + public void Assembly_name_matches_the_package_id() + { + PackageAssembly.GetName().Name.ShouldBe(PackageId); + } + + [Fact] + public void Assembly_has_a_semantic_informational_version() + { + var version = PackageAssembly.GetCustomAttribute()?.InformationalVersion; + + version.ShouldNotBeNull(); + SemanticVersion().IsMatch(version).ShouldBeTrue(version); + } + + [GeneratedRegex(@"^\d+\.\d+\.\d+(-[0-9A-Za-z.-]+)?(\+[0-9A-Za-z.-]+)?$")] + private static partial Regex SemanticVersion(); +} diff --git a/tests/WalterEgo.Alerting.Webhook.Tests/WalterEgo.Alerting.Webhook.Tests.csproj b/tests/WalterEgo.Alerting.Webhook.Tests/WalterEgo.Alerting.Webhook.Tests.csproj new file mode 100644 index 0000000..393b524 --- /dev/null +++ b/tests/WalterEgo.Alerting.Webhook.Tests/WalterEgo.Alerting.Webhook.Tests.csproj @@ -0,0 +1,7 @@ + + + + + + + diff --git a/tests/WalterEgo.Alerting.Webhook.Tests/packages.lock.json b/tests/WalterEgo.Alerting.Webhook.Tests/packages.lock.json new file mode 100644 index 0000000..7cc00a3 --- /dev/null +++ b/tests/WalterEgo.Alerting.Webhook.Tests/packages.lock.json @@ -0,0 +1,213 @@ +{ + "version": 2, + "dependencies": { + "net10.0": { + "Microsoft.Testing.Extensions.CodeCoverage": { + "type": "Direct", + "requested": "[18.12.0, )", + "resolved": "18.12.0", + "contentHash": "BST/sWYpKk9OXO7Yxktcg6FWORRsHU0EdCbMwZ7d3OqJsMKlrNHIZ30g0Ib4k5T5acJYXRBmg9mNrTU/N6cy1g==", + "dependencies": { + "Microsoft.DiaSymReader": "2.2.10", + "Microsoft.Extensions.DependencyModel": "10.0.10", + "Microsoft.Testing.Platform": "2.5.0", + "Mono.Cecil": "0.11.6" + } + }, + "MinVer": { + "type": "Direct", + "requested": "[8.0.0, )", + "resolved": "8.0.0", + "contentHash": "AJy/KVjXgUbgjf6HiI8wAk4DSSq0SCmvXQF8aU6IB+pnIQq+YJvofvMczug2hqO8yEvnQY557ryew66KPpyCsA==" + }, + "Shouldly": { + "type": "Direct", + "requested": "[4.3.0, )", + "resolved": "4.3.0", + "contentHash": "sDetrWXrl6YXZ4HeLsdBoNk3uIa7K+V4uvIJ+cqdRa5DrFxeTED7VkjoxCuU1kJWpUuBDZz2QXFzSxBtVXLwRQ==", + "dependencies": { + "DiffEngine": "11.3.0", + "EmptyFiles": "4.4.0" + } + }, + "xunit.v3": { + "type": "Direct", + "requested": "[4.0.2, )", + "resolved": "4.0.2", + "contentHash": "TdjM2OAx7w/0E88E6PgaigLoTbQaxbSR3HF/8p92plchTjf29jPHW27ylvEOz+Nx8CvPwWKGQlOR1fDv6/Qh5A==", + "dependencies": { + "xunit.v3.mtp-v2": "[4.0.2]" + } + }, + "DiffEngine": { + "type": "Transitive", + "resolved": "11.3.0", + "contentHash": "k0ZgZqd09jLZQjR8FyQbSQE86Q7QZnjEzq1LPHtj1R2AoWO8sjV5x+jlSisL7NZAbUOI4y+7Bog8gkr9WIRBGw==", + "dependencies": { + "EmptyFiles": "4.4.0", + "System.Management": "6.0.1" + } + }, + "EmptyFiles": { + "type": "Transitive", + "resolved": "4.4.0", + "contentHash": "gwJEfIGS7FhykvtZoscwXj/XwW+mJY6UbAZk+qtLKFUGWC95kfKXnj8VkxsZQnWBxJemM/q664rGLN5nf+OHZw==" + }, + "Microsoft.ApplicationInsights": { + "type": "Transitive", + "resolved": "2.23.0", + "contentHash": "nWArUZTdU7iqZLycLKWe0TDms48KKGE6pONH2terYNa8REXiqixrMOkf1sk5DHGMaUTqONU2YkS4SAXBhLStgw==" + }, + "Microsoft.Bcl.AsyncInterfaces": { + "type": "Transitive", + "resolved": "6.0.0", + "contentHash": "UcSjPsst+DfAdJGVDsu346FX0ci0ah+lw3WRtn18NUwEqRt70HaOQ7lI72vy3+1LxtqI3T5GWwV39rQSrCzAeg==" + }, + "Microsoft.DiaSymReader": { + "type": "Transitive", + "resolved": "2.2.10", + "contentHash": "zmGsm6b2y3STDa/Of7rdkkfTDV8VuGB8aCqIkLoJIQh5tL78K3zJ8OUyFKnfsaORXmGr9iOKwDkZfUjeXi+CwA==" + }, + "Microsoft.Extensions.DependencyModel": { + "type": "Transitive", + "resolved": "10.0.10", + "contentHash": "rfZA1RjR021RPqSmIPovfz2aOd79TGqJ9BengbjnzIISOVwjLmuSDnhCMmiY/1c6iYvGolQ1iNGzkav0u11XEA==" + }, + "Microsoft.Testing.Extensions.Telemetry": { + "type": "Transitive", + "resolved": "2.5.1", + "contentHash": "mu2iyoHovwl0q1mGeeRU0h8+LALXC7HqbxniLa1shTKYdJGl+KPoCEgjWIQ8MLzk1tlTGPOfg1JsxdH3RxhMCA==", + "dependencies": { + "Microsoft.ApplicationInsights": "2.23.0", + "Microsoft.Testing.Platform": "[2.5.1, 3.0.0)" + } + }, + "Microsoft.Testing.Extensions.TrxReport.Abstractions": { + "type": "Transitive", + "resolved": "2.5.1", + "contentHash": "DYTZAguaHz0wNJdHDTTGYOXtnlDoLoIbTMDKSApNNcytm55DJcnwpwELfQGLk5DB5QlgaEjNhnGo1Pu5QvL5VA==", + "dependencies": { + "Microsoft.Testing.Platform": "[2.5.1, 3.0.0)" + } + }, + "Microsoft.Testing.Platform": { + "type": "Transitive", + "resolved": "2.5.1", + "contentHash": "FAMaFFWnULW+hDHMb40Qzhcgz9cAU2/EtgRCBNX/DdQoKo0sPG2EiY+w7bQdl/BgHnf/DbpXLbf5Xy0o15M8NA==" + }, + "Microsoft.Testing.Platform.MSBuild": { + "type": "Transitive", + "resolved": "2.5.1", + "contentHash": "lYawcAwY+h76rQmpma2n0HaL8zkOFbbKapso0Eb+uOAUQn7333pIByLftEuiO67csAoZufHNMwi6PqhNemWQXA==", + "dependencies": { + "Microsoft.Testing.Platform": "[2.5.1, 3.0.0)" + } + }, + "Microsoft.Win32.Registry": { + "type": "Transitive", + "resolved": "5.0.0", + "contentHash": "dDoKi0PnDz31yAyETfRntsLArTlVAVzUzCIvvEDsDsucrl33Dl8pIJG06ePTJTI3tGpeyHS9Cq7Foc/s4EeKcg==" + }, + "Mono.Cecil": { + "type": "Transitive", + "resolved": "0.11.6", + "contentHash": "f33RkDtZO8VlGXCtmQIviOtxgnUdym9xx/b1p9h91CRGOsJFxCFOFK1FDbVt1OCf1aWwYejUFa2MOQyFWTFjbA==" + }, + "System.CodeDom": { + "type": "Transitive", + "resolved": "6.0.0", + "contentHash": "CPc6tWO1LAer3IzfZufDBRL+UZQcj5uS207NHALQzP84Vp/z6wF0Aa0YZImOQY8iStY0A2zI/e3ihKNPfUm8XA==" + }, + "System.Management": { + "type": "Transitive", + "resolved": "6.0.1", + "contentHash": "10J1D0h/lioojphfJ4Fuh5ZUThT/xOVHdV9roGBittKKNP2PMjrvibEdbVTGZcPra1399Ja3tqIJLyQrc5Wmhg==", + "dependencies": { + "System.CodeDom": "6.0.0" + } + }, + "System.Security.AccessControl": { + "type": "Transitive", + "resolved": "6.0.1", + "contentHash": "IQ4NXP/B3Ayzvw0rDQzVTYsCKyy0Jp9KI6aYcK7UnGVlR9+Awz++TIPCQtPYfLJfOpm8ajowMR09V7quD3sEHw==" + }, + "xunit.analyzers": { + "type": "Transitive", + "resolved": "2.2.0", + "contentHash": "dXMIIztipcAyL3a19gtUrih/RLrE33/4VJdICoinYqIXXo1KLtsMPsaQ9dO2pE8xajDguwE2kqVbBqE5/EoJ0Q==" + }, + "xunit.v3.assert": { + "type": "Transitive", + "resolved": "4.0.2", + "contentHash": "5PKRexYlvufWFdXenRcRGKqvaJBBZFJZpqUGlUs9p13eKEgVdOrLpkPknjzUvLY5kEUicK9871DIUDcCPA6AXA==" + }, + "xunit.v3.common": { + "type": "Transitive", + "resolved": "4.0.2", + "contentHash": "++CtT8daIf6qfieQev/8V88U3zViIDWou5cj+oWps1/Hf73UoaY/L0hKyi3v7Zlt3BmbU0pUc73zCB1GiB4nYA==", + "dependencies": { + "Microsoft.Bcl.AsyncInterfaces": "6.0.0" + } + }, + "xunit.v3.core.mtp-v2": { + "type": "Transitive", + "resolved": "4.0.2", + "contentHash": "XyPMcQRsnUQLhmBBRRgYWsuPc8TyiANzcXtqfzyWfDpPuyh3Q0K4oWozZYQKZRNGnqJ97ifD6qUDWhsEEe32uw==", + "dependencies": { + "Microsoft.Testing.Extensions.Telemetry": "2.5.1", + "Microsoft.Testing.Extensions.TrxReport.Abstractions": "2.5.1", + "Microsoft.Testing.Platform": "2.5.1", + "Microsoft.Testing.Platform.MSBuild": "2.5.1", + "xunit.v3.extensibility.core": "[4.0.2]", + "xunit.v3.runner.inproc.console": "[4.0.2]" + } + }, + "xunit.v3.extensibility.core": { + "type": "Transitive", + "resolved": "4.0.2", + "contentHash": "ARTt+pGyd86mdtiFBkKpyBQvRC3u0rr8oidBlII2GsAg7D6TfOsDFCsoQtFij83V5pE57m3whUIqT4xjiARXbQ==", + "dependencies": { + "xunit.v3.common": "[4.0.2]" + } + }, + "xunit.v3.mtp-v2": { + "type": "Transitive", + "resolved": "4.0.2", + "contentHash": "XLV32FhkuvheBStvX0DvjfPEtI+4SOVcIhnlTS+549r8VfVwsjpWdkJtQmQ7D23PA+Zoaqo+sTjBkRSkidC6Tw==", + "dependencies": { + "xunit.analyzers": "2.2.0", + "xunit.v3.assert": "[4.0.2]", + "xunit.v3.core.mtp-v2": "[4.0.2]" + } + }, + "xunit.v3.runner.common": { + "type": "Transitive", + "resolved": "4.0.2", + "contentHash": "YlYKVhTJVcwEgJ6rm59Pjf71lQqKwKxEHqVRxWUuwrwm/nxB/mNFP/lP4vlntDO3GclNnLT9BjYOpJH9gViGQg==", + "dependencies": { + "Microsoft.Win32.Registry": "[5.0.0]", + "System.Security.AccessControl": "[6.0.1]", + "xunit.v3.common": "[4.0.2]" + } + }, + "xunit.v3.runner.inproc.console": { + "type": "Transitive", + "resolved": "4.0.2", + "contentHash": "cg4XNpCN4Ry9nswutknpreN3ckSUBwtjMRmEQSNK/sIKPo6KN5tDGGGCaHDm5HGA4yFVVtTJX65tLCsZArUNfQ==", + "dependencies": { + "xunit.v3.extensibility.core": "[4.0.2]", + "xunit.v3.runner.common": "[4.0.2]" + } + }, + "walterego.alerting.webhook": { + "type": "Project", + "dependencies": { + "WalterEgo.Core": "[1.0.0, )" + } + }, + "walterego.core": { + "type": "Project" + } + } + } +} \ No newline at end of file diff --git a/tests/WalterEgo.AspNetCore.Identity.Tests/PackageIdentityTests.cs b/tests/WalterEgo.AspNetCore.Identity.Tests/PackageIdentityTests.cs new file mode 100644 index 0000000..ab80509 --- /dev/null +++ b/tests/WalterEgo.AspNetCore.Identity.Tests/PackageIdentityTests.cs @@ -0,0 +1,29 @@ +using System.Reflection; +using System.Text.RegularExpressions; + +namespace WalterEgo.AspNetCore.Identity.Tests; + +public sealed partial class PackageIdentityTests +{ + private const string PackageId = "WalterEgo.AspNetCore.Identity"; + + private static readonly Assembly PackageAssembly = Assembly.Load(PackageId); + + [Fact] + public void Assembly_name_matches_the_package_id() + { + PackageAssembly.GetName().Name.ShouldBe(PackageId); + } + + [Fact] + public void Assembly_has_a_semantic_informational_version() + { + var version = PackageAssembly.GetCustomAttribute()?.InformationalVersion; + + version.ShouldNotBeNull(); + SemanticVersion().IsMatch(version).ShouldBeTrue(version); + } + + [GeneratedRegex(@"^\d+\.\d+\.\d+(-[0-9A-Za-z.-]+)?(\+[0-9A-Za-z.-]+)?$")] + private static partial Regex SemanticVersion(); +} diff --git a/tests/WalterEgo.AspNetCore.Identity.Tests/WalterEgo.AspNetCore.Identity.Tests.csproj b/tests/WalterEgo.AspNetCore.Identity.Tests/WalterEgo.AspNetCore.Identity.Tests.csproj new file mode 100644 index 0000000..9ec2649 --- /dev/null +++ b/tests/WalterEgo.AspNetCore.Identity.Tests/WalterEgo.AspNetCore.Identity.Tests.csproj @@ -0,0 +1,7 @@ + + + + + + + diff --git a/tests/WalterEgo.AspNetCore.Identity.Tests/packages.lock.json b/tests/WalterEgo.AspNetCore.Identity.Tests/packages.lock.json new file mode 100644 index 0000000..f8816e3 --- /dev/null +++ b/tests/WalterEgo.AspNetCore.Identity.Tests/packages.lock.json @@ -0,0 +1,219 @@ +{ + "version": 2, + "dependencies": { + "net10.0": { + "Microsoft.Testing.Extensions.CodeCoverage": { + "type": "Direct", + "requested": "[18.12.0, )", + "resolved": "18.12.0", + "contentHash": "BST/sWYpKk9OXO7Yxktcg6FWORRsHU0EdCbMwZ7d3OqJsMKlrNHIZ30g0Ib4k5T5acJYXRBmg9mNrTU/N6cy1g==", + "dependencies": { + "Microsoft.DiaSymReader": "2.2.10", + "Microsoft.Extensions.DependencyModel": "10.0.10", + "Microsoft.Testing.Platform": "2.5.0", + "Mono.Cecil": "0.11.6" + } + }, + "MinVer": { + "type": "Direct", + "requested": "[8.0.0, )", + "resolved": "8.0.0", + "contentHash": "AJy/KVjXgUbgjf6HiI8wAk4DSSq0SCmvXQF8aU6IB+pnIQq+YJvofvMczug2hqO8yEvnQY557ryew66KPpyCsA==" + }, + "Shouldly": { + "type": "Direct", + "requested": "[4.3.0, )", + "resolved": "4.3.0", + "contentHash": "sDetrWXrl6YXZ4HeLsdBoNk3uIa7K+V4uvIJ+cqdRa5DrFxeTED7VkjoxCuU1kJWpUuBDZz2QXFzSxBtVXLwRQ==", + "dependencies": { + "DiffEngine": "11.3.0", + "EmptyFiles": "4.4.0" + } + }, + "xunit.v3": { + "type": "Direct", + "requested": "[4.0.2, )", + "resolved": "4.0.2", + "contentHash": "TdjM2OAx7w/0E88E6PgaigLoTbQaxbSR3HF/8p92plchTjf29jPHW27ylvEOz+Nx8CvPwWKGQlOR1fDv6/Qh5A==", + "dependencies": { + "xunit.v3.mtp-v2": "[4.0.2]" + } + }, + "DiffEngine": { + "type": "Transitive", + "resolved": "11.3.0", + "contentHash": "k0ZgZqd09jLZQjR8FyQbSQE86Q7QZnjEzq1LPHtj1R2AoWO8sjV5x+jlSisL7NZAbUOI4y+7Bog8gkr9WIRBGw==", + "dependencies": { + "EmptyFiles": "4.4.0", + "System.Management": "6.0.1" + } + }, + "EmptyFiles": { + "type": "Transitive", + "resolved": "4.4.0", + "contentHash": "gwJEfIGS7FhykvtZoscwXj/XwW+mJY6UbAZk+qtLKFUGWC95kfKXnj8VkxsZQnWBxJemM/q664rGLN5nf+OHZw==" + }, + "Microsoft.ApplicationInsights": { + "type": "Transitive", + "resolved": "2.23.0", + "contentHash": "nWArUZTdU7iqZLycLKWe0TDms48KKGE6pONH2terYNa8REXiqixrMOkf1sk5DHGMaUTqONU2YkS4SAXBhLStgw==" + }, + "Microsoft.Bcl.AsyncInterfaces": { + "type": "Transitive", + "resolved": "6.0.0", + "contentHash": "UcSjPsst+DfAdJGVDsu346FX0ci0ah+lw3WRtn18NUwEqRt70HaOQ7lI72vy3+1LxtqI3T5GWwV39rQSrCzAeg==" + }, + "Microsoft.DiaSymReader": { + "type": "Transitive", + "resolved": "2.2.10", + "contentHash": "zmGsm6b2y3STDa/Of7rdkkfTDV8VuGB8aCqIkLoJIQh5tL78K3zJ8OUyFKnfsaORXmGr9iOKwDkZfUjeXi+CwA==" + }, + "Microsoft.Extensions.DependencyModel": { + "type": "Transitive", + "resolved": "10.0.10", + "contentHash": "rfZA1RjR021RPqSmIPovfz2aOd79TGqJ9BengbjnzIISOVwjLmuSDnhCMmiY/1c6iYvGolQ1iNGzkav0u11XEA==" + }, + "Microsoft.Testing.Extensions.Telemetry": { + "type": "Transitive", + "resolved": "2.5.1", + "contentHash": "mu2iyoHovwl0q1mGeeRU0h8+LALXC7HqbxniLa1shTKYdJGl+KPoCEgjWIQ8MLzk1tlTGPOfg1JsxdH3RxhMCA==", + "dependencies": { + "Microsoft.ApplicationInsights": "2.23.0", + "Microsoft.Testing.Platform": "[2.5.1, 3.0.0)" + } + }, + "Microsoft.Testing.Extensions.TrxReport.Abstractions": { + "type": "Transitive", + "resolved": "2.5.1", + "contentHash": "DYTZAguaHz0wNJdHDTTGYOXtnlDoLoIbTMDKSApNNcytm55DJcnwpwELfQGLk5DB5QlgaEjNhnGo1Pu5QvL5VA==", + "dependencies": { + "Microsoft.Testing.Platform": "[2.5.1, 3.0.0)" + } + }, + "Microsoft.Testing.Platform": { + "type": "Transitive", + "resolved": "2.5.1", + "contentHash": "FAMaFFWnULW+hDHMb40Qzhcgz9cAU2/EtgRCBNX/DdQoKo0sPG2EiY+w7bQdl/BgHnf/DbpXLbf5Xy0o15M8NA==" + }, + "Microsoft.Testing.Platform.MSBuild": { + "type": "Transitive", + "resolved": "2.5.1", + "contentHash": "lYawcAwY+h76rQmpma2n0HaL8zkOFbbKapso0Eb+uOAUQn7333pIByLftEuiO67csAoZufHNMwi6PqhNemWQXA==", + "dependencies": { + "Microsoft.Testing.Platform": "[2.5.1, 3.0.0)" + } + }, + "Microsoft.Win32.Registry": { + "type": "Transitive", + "resolved": "5.0.0", + "contentHash": "dDoKi0PnDz31yAyETfRntsLArTlVAVzUzCIvvEDsDsucrl33Dl8pIJG06ePTJTI3tGpeyHS9Cq7Foc/s4EeKcg==" + }, + "Mono.Cecil": { + "type": "Transitive", + "resolved": "0.11.6", + "contentHash": "f33RkDtZO8VlGXCtmQIviOtxgnUdym9xx/b1p9h91CRGOsJFxCFOFK1FDbVt1OCf1aWwYejUFa2MOQyFWTFjbA==" + }, + "System.CodeDom": { + "type": "Transitive", + "resolved": "6.0.0", + "contentHash": "CPc6tWO1LAer3IzfZufDBRL+UZQcj5uS207NHALQzP84Vp/z6wF0Aa0YZImOQY8iStY0A2zI/e3ihKNPfUm8XA==" + }, + "System.Management": { + "type": "Transitive", + "resolved": "6.0.1", + "contentHash": "10J1D0h/lioojphfJ4Fuh5ZUThT/xOVHdV9roGBittKKNP2PMjrvibEdbVTGZcPra1399Ja3tqIJLyQrc5Wmhg==", + "dependencies": { + "System.CodeDom": "6.0.0" + } + }, + "System.Security.AccessControl": { + "type": "Transitive", + "resolved": "6.0.1", + "contentHash": "IQ4NXP/B3Ayzvw0rDQzVTYsCKyy0Jp9KI6aYcK7UnGVlR9+Awz++TIPCQtPYfLJfOpm8ajowMR09V7quD3sEHw==" + }, + "xunit.analyzers": { + "type": "Transitive", + "resolved": "2.2.0", + "contentHash": "dXMIIztipcAyL3a19gtUrih/RLrE33/4VJdICoinYqIXXo1KLtsMPsaQ9dO2pE8xajDguwE2kqVbBqE5/EoJ0Q==" + }, + "xunit.v3.assert": { + "type": "Transitive", + "resolved": "4.0.2", + "contentHash": "5PKRexYlvufWFdXenRcRGKqvaJBBZFJZpqUGlUs9p13eKEgVdOrLpkPknjzUvLY5kEUicK9871DIUDcCPA6AXA==" + }, + "xunit.v3.common": { + "type": "Transitive", + "resolved": "4.0.2", + "contentHash": "++CtT8daIf6qfieQev/8V88U3zViIDWou5cj+oWps1/Hf73UoaY/L0hKyi3v7Zlt3BmbU0pUc73zCB1GiB4nYA==", + "dependencies": { + "Microsoft.Bcl.AsyncInterfaces": "6.0.0" + } + }, + "xunit.v3.core.mtp-v2": { + "type": "Transitive", + "resolved": "4.0.2", + "contentHash": "XyPMcQRsnUQLhmBBRRgYWsuPc8TyiANzcXtqfzyWfDpPuyh3Q0K4oWozZYQKZRNGnqJ97ifD6qUDWhsEEe32uw==", + "dependencies": { + "Microsoft.Testing.Extensions.Telemetry": "2.5.1", + "Microsoft.Testing.Extensions.TrxReport.Abstractions": "2.5.1", + "Microsoft.Testing.Platform": "2.5.1", + "Microsoft.Testing.Platform.MSBuild": "2.5.1", + "xunit.v3.extensibility.core": "[4.0.2]", + "xunit.v3.runner.inproc.console": "[4.0.2]" + } + }, + "xunit.v3.extensibility.core": { + "type": "Transitive", + "resolved": "4.0.2", + "contentHash": "ARTt+pGyd86mdtiFBkKpyBQvRC3u0rr8oidBlII2GsAg7D6TfOsDFCsoQtFij83V5pE57m3whUIqT4xjiARXbQ==", + "dependencies": { + "xunit.v3.common": "[4.0.2]" + } + }, + "xunit.v3.mtp-v2": { + "type": "Transitive", + "resolved": "4.0.2", + "contentHash": "XLV32FhkuvheBStvX0DvjfPEtI+4SOVcIhnlTS+549r8VfVwsjpWdkJtQmQ7D23PA+Zoaqo+sTjBkRSkidC6Tw==", + "dependencies": { + "xunit.analyzers": "2.2.0", + "xunit.v3.assert": "[4.0.2]", + "xunit.v3.core.mtp-v2": "[4.0.2]" + } + }, + "xunit.v3.runner.common": { + "type": "Transitive", + "resolved": "4.0.2", + "contentHash": "YlYKVhTJVcwEgJ6rm59Pjf71lQqKwKxEHqVRxWUuwrwm/nxB/mNFP/lP4vlntDO3GclNnLT9BjYOpJH9gViGQg==", + "dependencies": { + "Microsoft.Win32.Registry": "[5.0.0]", + "System.Security.AccessControl": "[6.0.1]", + "xunit.v3.common": "[4.0.2]" + } + }, + "xunit.v3.runner.inproc.console": { + "type": "Transitive", + "resolved": "4.0.2", + "contentHash": "cg4XNpCN4Ry9nswutknpreN3ckSUBwtjMRmEQSNK/sIKPo6KN5tDGGGCaHDm5HGA4yFVVtTJX65tLCsZArUNfQ==", + "dependencies": { + "xunit.v3.extensibility.core": "[4.0.2]", + "xunit.v3.runner.common": "[4.0.2]" + } + }, + "walterego.aspnetcore": { + "type": "Project", + "dependencies": { + "WalterEgo.Core": "[1.0.0, )" + } + }, + "walterego.aspnetcore.identity": { + "type": "Project", + "dependencies": { + "WalterEgo.AspNetCore": "[1.0.0, )" + } + }, + "walterego.core": { + "type": "Project" + } + } + } +} \ No newline at end of file diff --git a/tests/WalterEgo.AspNetCore.Tests/PackageIdentityTests.cs b/tests/WalterEgo.AspNetCore.Tests/PackageIdentityTests.cs new file mode 100644 index 0000000..b96e1ed --- /dev/null +++ b/tests/WalterEgo.AspNetCore.Tests/PackageIdentityTests.cs @@ -0,0 +1,29 @@ +using System.Reflection; +using System.Text.RegularExpressions; + +namespace WalterEgo.AspNetCore.Tests; + +public sealed partial class PackageIdentityTests +{ + private const string PackageId = "WalterEgo.AspNetCore"; + + private static readonly Assembly PackageAssembly = Assembly.Load(PackageId); + + [Fact] + public void Assembly_name_matches_the_package_id() + { + PackageAssembly.GetName().Name.ShouldBe(PackageId); + } + + [Fact] + public void Assembly_has_a_semantic_informational_version() + { + var version = PackageAssembly.GetCustomAttribute()?.InformationalVersion; + + version.ShouldNotBeNull(); + SemanticVersion().IsMatch(version).ShouldBeTrue(version); + } + + [GeneratedRegex(@"^\d+\.\d+\.\d+(-[0-9A-Za-z.-]+)?(\+[0-9A-Za-z.-]+)?$")] + private static partial Regex SemanticVersion(); +} diff --git a/tests/WalterEgo.AspNetCore.Tests/WalterEgo.AspNetCore.Tests.csproj b/tests/WalterEgo.AspNetCore.Tests/WalterEgo.AspNetCore.Tests.csproj new file mode 100644 index 0000000..3dd596e --- /dev/null +++ b/tests/WalterEgo.AspNetCore.Tests/WalterEgo.AspNetCore.Tests.csproj @@ -0,0 +1,7 @@ + + + + + + + diff --git a/tests/WalterEgo.AspNetCore.Tests/packages.lock.json b/tests/WalterEgo.AspNetCore.Tests/packages.lock.json new file mode 100644 index 0000000..c842dad --- /dev/null +++ b/tests/WalterEgo.AspNetCore.Tests/packages.lock.json @@ -0,0 +1,213 @@ +{ + "version": 2, + "dependencies": { + "net10.0": { + "Microsoft.Testing.Extensions.CodeCoverage": { + "type": "Direct", + "requested": "[18.12.0, )", + "resolved": "18.12.0", + "contentHash": "BST/sWYpKk9OXO7Yxktcg6FWORRsHU0EdCbMwZ7d3OqJsMKlrNHIZ30g0Ib4k5T5acJYXRBmg9mNrTU/N6cy1g==", + "dependencies": { + "Microsoft.DiaSymReader": "2.2.10", + "Microsoft.Extensions.DependencyModel": "10.0.10", + "Microsoft.Testing.Platform": "2.5.0", + "Mono.Cecil": "0.11.6" + } + }, + "MinVer": { + "type": "Direct", + "requested": "[8.0.0, )", + "resolved": "8.0.0", + "contentHash": "AJy/KVjXgUbgjf6HiI8wAk4DSSq0SCmvXQF8aU6IB+pnIQq+YJvofvMczug2hqO8yEvnQY557ryew66KPpyCsA==" + }, + "Shouldly": { + "type": "Direct", + "requested": "[4.3.0, )", + "resolved": "4.3.0", + "contentHash": "sDetrWXrl6YXZ4HeLsdBoNk3uIa7K+V4uvIJ+cqdRa5DrFxeTED7VkjoxCuU1kJWpUuBDZz2QXFzSxBtVXLwRQ==", + "dependencies": { + "DiffEngine": "11.3.0", + "EmptyFiles": "4.4.0" + } + }, + "xunit.v3": { + "type": "Direct", + "requested": "[4.0.2, )", + "resolved": "4.0.2", + "contentHash": "TdjM2OAx7w/0E88E6PgaigLoTbQaxbSR3HF/8p92plchTjf29jPHW27ylvEOz+Nx8CvPwWKGQlOR1fDv6/Qh5A==", + "dependencies": { + "xunit.v3.mtp-v2": "[4.0.2]" + } + }, + "DiffEngine": { + "type": "Transitive", + "resolved": "11.3.0", + "contentHash": "k0ZgZqd09jLZQjR8FyQbSQE86Q7QZnjEzq1LPHtj1R2AoWO8sjV5x+jlSisL7NZAbUOI4y+7Bog8gkr9WIRBGw==", + "dependencies": { + "EmptyFiles": "4.4.0", + "System.Management": "6.0.1" + } + }, + "EmptyFiles": { + "type": "Transitive", + "resolved": "4.4.0", + "contentHash": "gwJEfIGS7FhykvtZoscwXj/XwW+mJY6UbAZk+qtLKFUGWC95kfKXnj8VkxsZQnWBxJemM/q664rGLN5nf+OHZw==" + }, + "Microsoft.ApplicationInsights": { + "type": "Transitive", + "resolved": "2.23.0", + "contentHash": "nWArUZTdU7iqZLycLKWe0TDms48KKGE6pONH2terYNa8REXiqixrMOkf1sk5DHGMaUTqONU2YkS4SAXBhLStgw==" + }, + "Microsoft.Bcl.AsyncInterfaces": { + "type": "Transitive", + "resolved": "6.0.0", + "contentHash": "UcSjPsst+DfAdJGVDsu346FX0ci0ah+lw3WRtn18NUwEqRt70HaOQ7lI72vy3+1LxtqI3T5GWwV39rQSrCzAeg==" + }, + "Microsoft.DiaSymReader": { + "type": "Transitive", + "resolved": "2.2.10", + "contentHash": "zmGsm6b2y3STDa/Of7rdkkfTDV8VuGB8aCqIkLoJIQh5tL78K3zJ8OUyFKnfsaORXmGr9iOKwDkZfUjeXi+CwA==" + }, + "Microsoft.Extensions.DependencyModel": { + "type": "Transitive", + "resolved": "10.0.10", + "contentHash": "rfZA1RjR021RPqSmIPovfz2aOd79TGqJ9BengbjnzIISOVwjLmuSDnhCMmiY/1c6iYvGolQ1iNGzkav0u11XEA==" + }, + "Microsoft.Testing.Extensions.Telemetry": { + "type": "Transitive", + "resolved": "2.5.1", + "contentHash": "mu2iyoHovwl0q1mGeeRU0h8+LALXC7HqbxniLa1shTKYdJGl+KPoCEgjWIQ8MLzk1tlTGPOfg1JsxdH3RxhMCA==", + "dependencies": { + "Microsoft.ApplicationInsights": "2.23.0", + "Microsoft.Testing.Platform": "[2.5.1, 3.0.0)" + } + }, + "Microsoft.Testing.Extensions.TrxReport.Abstractions": { + "type": "Transitive", + "resolved": "2.5.1", + "contentHash": "DYTZAguaHz0wNJdHDTTGYOXtnlDoLoIbTMDKSApNNcytm55DJcnwpwELfQGLk5DB5QlgaEjNhnGo1Pu5QvL5VA==", + "dependencies": { + "Microsoft.Testing.Platform": "[2.5.1, 3.0.0)" + } + }, + "Microsoft.Testing.Platform": { + "type": "Transitive", + "resolved": "2.5.1", + "contentHash": "FAMaFFWnULW+hDHMb40Qzhcgz9cAU2/EtgRCBNX/DdQoKo0sPG2EiY+w7bQdl/BgHnf/DbpXLbf5Xy0o15M8NA==" + }, + "Microsoft.Testing.Platform.MSBuild": { + "type": "Transitive", + "resolved": "2.5.1", + "contentHash": "lYawcAwY+h76rQmpma2n0HaL8zkOFbbKapso0Eb+uOAUQn7333pIByLftEuiO67csAoZufHNMwi6PqhNemWQXA==", + "dependencies": { + "Microsoft.Testing.Platform": "[2.5.1, 3.0.0)" + } + }, + "Microsoft.Win32.Registry": { + "type": "Transitive", + "resolved": "5.0.0", + "contentHash": "dDoKi0PnDz31yAyETfRntsLArTlVAVzUzCIvvEDsDsucrl33Dl8pIJG06ePTJTI3tGpeyHS9Cq7Foc/s4EeKcg==" + }, + "Mono.Cecil": { + "type": "Transitive", + "resolved": "0.11.6", + "contentHash": "f33RkDtZO8VlGXCtmQIviOtxgnUdym9xx/b1p9h91CRGOsJFxCFOFK1FDbVt1OCf1aWwYejUFa2MOQyFWTFjbA==" + }, + "System.CodeDom": { + "type": "Transitive", + "resolved": "6.0.0", + "contentHash": "CPc6tWO1LAer3IzfZufDBRL+UZQcj5uS207NHALQzP84Vp/z6wF0Aa0YZImOQY8iStY0A2zI/e3ihKNPfUm8XA==" + }, + "System.Management": { + "type": "Transitive", + "resolved": "6.0.1", + "contentHash": "10J1D0h/lioojphfJ4Fuh5ZUThT/xOVHdV9roGBittKKNP2PMjrvibEdbVTGZcPra1399Ja3tqIJLyQrc5Wmhg==", + "dependencies": { + "System.CodeDom": "6.0.0" + } + }, + "System.Security.AccessControl": { + "type": "Transitive", + "resolved": "6.0.1", + "contentHash": "IQ4NXP/B3Ayzvw0rDQzVTYsCKyy0Jp9KI6aYcK7UnGVlR9+Awz++TIPCQtPYfLJfOpm8ajowMR09V7quD3sEHw==" + }, + "xunit.analyzers": { + "type": "Transitive", + "resolved": "2.2.0", + "contentHash": "dXMIIztipcAyL3a19gtUrih/RLrE33/4VJdICoinYqIXXo1KLtsMPsaQ9dO2pE8xajDguwE2kqVbBqE5/EoJ0Q==" + }, + "xunit.v3.assert": { + "type": "Transitive", + "resolved": "4.0.2", + "contentHash": "5PKRexYlvufWFdXenRcRGKqvaJBBZFJZpqUGlUs9p13eKEgVdOrLpkPknjzUvLY5kEUicK9871DIUDcCPA6AXA==" + }, + "xunit.v3.common": { + "type": "Transitive", + "resolved": "4.0.2", + "contentHash": "++CtT8daIf6qfieQev/8V88U3zViIDWou5cj+oWps1/Hf73UoaY/L0hKyi3v7Zlt3BmbU0pUc73zCB1GiB4nYA==", + "dependencies": { + "Microsoft.Bcl.AsyncInterfaces": "6.0.0" + } + }, + "xunit.v3.core.mtp-v2": { + "type": "Transitive", + "resolved": "4.0.2", + "contentHash": "XyPMcQRsnUQLhmBBRRgYWsuPc8TyiANzcXtqfzyWfDpPuyh3Q0K4oWozZYQKZRNGnqJ97ifD6qUDWhsEEe32uw==", + "dependencies": { + "Microsoft.Testing.Extensions.Telemetry": "2.5.1", + "Microsoft.Testing.Extensions.TrxReport.Abstractions": "2.5.1", + "Microsoft.Testing.Platform": "2.5.1", + "Microsoft.Testing.Platform.MSBuild": "2.5.1", + "xunit.v3.extensibility.core": "[4.0.2]", + "xunit.v3.runner.inproc.console": "[4.0.2]" + } + }, + "xunit.v3.extensibility.core": { + "type": "Transitive", + "resolved": "4.0.2", + "contentHash": "ARTt+pGyd86mdtiFBkKpyBQvRC3u0rr8oidBlII2GsAg7D6TfOsDFCsoQtFij83V5pE57m3whUIqT4xjiARXbQ==", + "dependencies": { + "xunit.v3.common": "[4.0.2]" + } + }, + "xunit.v3.mtp-v2": { + "type": "Transitive", + "resolved": "4.0.2", + "contentHash": "XLV32FhkuvheBStvX0DvjfPEtI+4SOVcIhnlTS+549r8VfVwsjpWdkJtQmQ7D23PA+Zoaqo+sTjBkRSkidC6Tw==", + "dependencies": { + "xunit.analyzers": "2.2.0", + "xunit.v3.assert": "[4.0.2]", + "xunit.v3.core.mtp-v2": "[4.0.2]" + } + }, + "xunit.v3.runner.common": { + "type": "Transitive", + "resolved": "4.0.2", + "contentHash": "YlYKVhTJVcwEgJ6rm59Pjf71lQqKwKxEHqVRxWUuwrwm/nxB/mNFP/lP4vlntDO3GclNnLT9BjYOpJH9gViGQg==", + "dependencies": { + "Microsoft.Win32.Registry": "[5.0.0]", + "System.Security.AccessControl": "[6.0.1]", + "xunit.v3.common": "[4.0.2]" + } + }, + "xunit.v3.runner.inproc.console": { + "type": "Transitive", + "resolved": "4.0.2", + "contentHash": "cg4XNpCN4Ry9nswutknpreN3ckSUBwtjMRmEQSNK/sIKPo6KN5tDGGGCaHDm5HGA4yFVVtTJX65tLCsZArUNfQ==", + "dependencies": { + "xunit.v3.extensibility.core": "[4.0.2]", + "xunit.v3.runner.common": "[4.0.2]" + } + }, + "walterego.aspnetcore": { + "type": "Project", + "dependencies": { + "WalterEgo.Core": "[1.0.0, )" + } + }, + "walterego.core": { + "type": "Project" + } + } + } +} \ No newline at end of file diff --git a/tests/WalterEgo.Benchmarks/Program.cs b/tests/WalterEgo.Benchmarks/Program.cs new file mode 100644 index 0000000..c9a0467 --- /dev/null +++ b/tests/WalterEgo.Benchmarks/Program.cs @@ -0,0 +1,3 @@ +using BenchmarkDotNet.Running; + +BenchmarkSwitcher.FromAssembly(typeof(Program).Assembly).Run(args); diff --git a/tests/WalterEgo.Benchmarks/WalterEgo.Benchmarks.csproj b/tests/WalterEgo.Benchmarks/WalterEgo.Benchmarks.csproj new file mode 100644 index 0000000..b0ac756 --- /dev/null +++ b/tests/WalterEgo.Benchmarks/WalterEgo.Benchmarks.csproj @@ -0,0 +1,11 @@ + + + + Exe + + + + + + + diff --git a/tests/WalterEgo.Benchmarks/packages.lock.json b/tests/WalterEgo.Benchmarks/packages.lock.json new file mode 100644 index 0000000..39b8dde --- /dev/null +++ b/tests/WalterEgo.Benchmarks/packages.lock.json @@ -0,0 +1,177 @@ +{ + "version": 2, + "dependencies": { + "net10.0": { + "BenchmarkDotNet": { + "type": "Direct", + "requested": "[0.15.8, )", + "resolved": "0.15.8", + "contentHash": "paCfrWxSeHqn3rUZc0spYXVFnHCF0nzRhG0nOLnyTjZYs8spsimBaaNmb3vwqvALKIplbYq/TF393vYiYSnh/Q==", + "dependencies": { + "BenchmarkDotNet.Annotations": "0.15.8", + "CommandLineParser": "2.9.1", + "Gee.External.Capstone": "2.3.0", + "Iced": "1.21.0", + "Microsoft.CodeAnalysis.CSharp": "4.14.0", + "Microsoft.Diagnostics.Runtime": "3.1.512801", + "Microsoft.Diagnostics.Tracing.TraceEvent": "3.1.21", + "Microsoft.DotNet.PlatformAbstractions": "3.1.6", + "Perfolizer": "[0.6.1]", + "System.Management": "9.0.5" + } + }, + "MinVer": { + "type": "Direct", + "requested": "[8.0.0, )", + "resolved": "8.0.0", + "contentHash": "AJy/KVjXgUbgjf6HiI8wAk4DSSq0SCmvXQF8aU6IB+pnIQq+YJvofvMczug2hqO8yEvnQY557ryew66KPpyCsA==" + }, + "BenchmarkDotNet.Annotations": { + "type": "Transitive", + "resolved": "0.15.8", + "contentHash": "hfucY0ycAsB0SsoaZcaAp9oq5wlWBJcylvEJb9pmvdYUx6PD6S4mDiYnZWjdjAlLhIpe/xtGCwzORfzAzPqvzA==" + }, + "CommandLineParser": { + "type": "Transitive", + "resolved": "2.9.1", + "contentHash": "OE0sl1/sQ37bjVsPKKtwQlWDgqaxWgtme3xZz7JssWUzg5JpMIyHgCTY9MVMxOg48fJ1AgGT3tgdH5m/kQ5xhA==" + }, + "Gee.External.Capstone": { + "type": "Transitive", + "resolved": "2.3.0", + "contentHash": "2ap/rYmjtzCOT8hxrnEW/QeiOt+paD8iRrIcdKX0cxVwWLFa1e+JDBNeECakmccXrSFeBQuu5AV8SNkipFMMMw==" + }, + "Iced": { + "type": "Transitive", + "resolved": "1.21.0", + "contentHash": "dv5+81Q1TBQvVMSOOOmRcjJmvWcX3BZPZsIq31+RLc5cNft0IHAyNlkdb7ZarOWG913PyBoFDsDXoCIlKmLclg==" + }, + "Microsoft.CodeAnalysis.Analyzers": { + "type": "Transitive", + "resolved": "3.11.0", + "contentHash": "v/EW3UE8/lbEYHoC2Qq7AR/DnmvpgdtAMndfQNmpuIMx/Mto8L5JnuCfdBYtgvalQOtfNCnxFejxuRrryvUTsg==" + }, + "Microsoft.CodeAnalysis.Common": { + "type": "Transitive", + "resolved": "4.14.0", + "contentHash": "PC3tuwZYnC+idaPuoC/AZpEdwrtX7qFpmnrfQkgobGIWiYmGi5MCRtl5mx6QrfMGQpK78X2lfIEoZDLg/qnuHg==", + "dependencies": { + "Microsoft.CodeAnalysis.Analyzers": "3.11.0" + } + }, + "Microsoft.CodeAnalysis.CSharp": { + "type": "Transitive", + "resolved": "4.14.0", + "contentHash": "568a6wcTivauIhbeWcCwfWwIn7UV7MeHEBvFB2uzGIpM2OhJ4eM/FZ8KS0yhPoNxnSpjGzz7x7CIjTxhslojQA==", + "dependencies": { + "Microsoft.CodeAnalysis.Analyzers": "3.11.0", + "Microsoft.CodeAnalysis.Common": "[4.14.0]" + } + }, + "Microsoft.Diagnostics.NETCore.Client": { + "type": "Transitive", + "resolved": "0.2.510501", + "contentHash": "juoqJYMDs+lRrrZyOkXXMImJHneCF23cuvO4waFRd2Ds7j+ZuGIPbJm0Y/zz34BdeaGiiwGWraMUlln05W1PCQ==", + "dependencies": { + "Microsoft.Extensions.Logging": "6.0.0" + } + }, + "Microsoft.Diagnostics.Runtime": { + "type": "Transitive", + "resolved": "3.1.512801", + "contentHash": "0lMUDr2oxNZa28D6NH5BuSQEe5T9tZziIkvkD44YkkCGQXPJqvFjLq5ZQq1hYLl3RjQJrY+hR0jFgap+EWPDTw==", + "dependencies": { + "Microsoft.Diagnostics.NETCore.Client": "0.2.410101" + } + }, + "Microsoft.Diagnostics.Tracing.TraceEvent": { + "type": "Transitive", + "resolved": "3.1.21", + "contentHash": "/OrJFKaojSR6TkUKtwh8/qA9XWNtxLrXMqvEb89dBSKCWjaGVTbKMYodIUgF5deCEtmd6GXuRerciXGl5bhZ7Q==", + "dependencies": { + "Microsoft.Diagnostics.NETCore.Client": "0.2.510501", + "System.Reflection.TypeExtensions": "4.7.0" + } + }, + "Microsoft.DotNet.PlatformAbstractions": { + "type": "Transitive", + "resolved": "3.1.6", + "contentHash": "jek4XYaQ/PGUwDKKhwR8K47Uh1189PFzMeLqO83mXrXQVIpARZCcfuDedH50YDTepBkfijCZN5U/vZi++erxtg==" + }, + "Microsoft.Extensions.DependencyInjection": { + "type": "Transitive", + "resolved": "6.0.0", + "contentHash": "k6PWQMuoBDGGHOQTtyois2u4AwyVcIwL2LaSLlTZQm2CYcJ1pxbt6jfAnpWmzENA/wfrYRI/X9DTLoUkE4AsLw==", + "dependencies": { + "Microsoft.Extensions.DependencyInjection.Abstractions": "6.0.0" + } + }, + "Microsoft.Extensions.DependencyInjection.Abstractions": { + "type": "Transitive", + "resolved": "6.0.0", + "contentHash": "xlzi2IYREJH3/m6+lUrQlujzX8wDitm4QGnUu6kUXTQAWPuZY8i+ticFJbzfqaetLA6KR/rO6Ew/HuYD+bxifg==" + }, + "Microsoft.Extensions.Logging": { + "type": "Transitive", + "resolved": "6.0.0", + "contentHash": "eIbyj40QDg1NDz0HBW0S5f3wrLVnKWnDJ/JtZ+yJDFnDj90VoPuoPmFkeaXrtu+0cKm5GRAwoDf+dBWXK0TUdg==", + "dependencies": { + "Microsoft.Extensions.DependencyInjection": "6.0.0", + "Microsoft.Extensions.DependencyInjection.Abstractions": "6.0.0", + "Microsoft.Extensions.Logging.Abstractions": "6.0.0", + "Microsoft.Extensions.Options": "6.0.0" + } + }, + "Microsoft.Extensions.Logging.Abstractions": { + "type": "Transitive", + "resolved": "6.0.0", + "contentHash": "/HggWBbTwy8TgebGSX5DBZ24ndhzi93sHUBDvP1IxbZD7FDokYzdAr6+vbWGjw2XAfR2EJ1sfKUotpjHnFWPxA==" + }, + "Microsoft.Extensions.Options": { + "type": "Transitive", + "resolved": "6.0.0", + "contentHash": "dzXN0+V1AyjOe2xcJ86Qbo233KHuLEY0njf/P2Kw8SfJU+d45HNS2ctJdnEnrWbM9Ye2eFgaC5Mj9otRMU6IsQ==", + "dependencies": { + "Microsoft.Extensions.DependencyInjection.Abstractions": "6.0.0", + "Microsoft.Extensions.Primitives": "6.0.0" + } + }, + "Microsoft.Extensions.Primitives": { + "type": "Transitive", + "resolved": "6.0.0", + "contentHash": "9+PnzmQFfEFNR9J2aDTfJGGupShHjOuGw4VUv+JB044biSHrnmCIMD+mJHmb2H7YryrfBEXDurxQ47gJZdCKNQ==" + }, + "Perfolizer": { + "type": "Transitive", + "resolved": "0.6.1", + "contentHash": "CR1QmWg4XYBd1Pb7WseP+sDmV8nGPwvmowKynExTqr3OuckIGVMhvmN4LC5PGzfXqDlR295+hz/T7syA1CxEqA==", + "dependencies": { + "Pragmastat": "3.2.4" + } + }, + "Pragmastat": { + "type": "Transitive", + "resolved": "3.2.4", + "contentHash": "I5qFifWw/gaTQT52MhzjZpkm/JPlfjSeO/DTZJjO7+hTKI+0aGRgOgZ3NN6D96dDuuqbIAZSeA5RimtHjqrA2A==" + }, + "System.CodeDom": { + "type": "Transitive", + "resolved": "9.0.5", + "contentHash": "cuzLM2MWutf9ZBEMPYYfd0DXwYdvntp7VCT6a/wvbKCa2ZuvGmW74xi+YBa2mrfEieAXqM4TNKlMmSnfAfpUoQ==" + }, + "System.Management": { + "type": "Transitive", + "resolved": "9.0.5", + "contentHash": "n6o9PZm9p25+zAzC3/48K0oHnaPKTInRrxqFq1fi/5TPbMLjuoCm/h//mS3cUmSy+9AO1Z+qsC/Ilt/ZFatv5Q==", + "dependencies": { + "System.CodeDom": "9.0.5" + } + }, + "System.Reflection.TypeExtensions": { + "type": "Transitive", + "resolved": "4.7.0", + "contentHash": "VybpaOQQhqE6siHppMktjfGBw1GCwvCqiufqmP8F1nj7fTUNtW35LOEt3UZTEsECfo+ELAl/9o9nJx3U91i7vA==" + } + } + } +} \ No newline at end of file diff --git a/tests/WalterEgo.Cli.Tests/PackageIdentityTests.cs b/tests/WalterEgo.Cli.Tests/PackageIdentityTests.cs new file mode 100644 index 0000000..7de15ff --- /dev/null +++ b/tests/WalterEgo.Cli.Tests/PackageIdentityTests.cs @@ -0,0 +1,29 @@ +using System.Reflection; +using System.Text.RegularExpressions; + +namespace WalterEgo.Cli.Tests; + +public sealed partial class PackageIdentityTests +{ + private const string PackageId = "WalterEgo.Cli"; + + private static readonly Assembly PackageAssembly = Assembly.Load(PackageId); + + [Fact] + public void Assembly_name_matches_the_package_id() + { + PackageAssembly.GetName().Name.ShouldBe(PackageId); + } + + [Fact] + public void Assembly_has_a_semantic_informational_version() + { + var version = PackageAssembly.GetCustomAttribute()?.InformationalVersion; + + version.ShouldNotBeNull(); + SemanticVersion().IsMatch(version).ShouldBeTrue(version); + } + + [GeneratedRegex(@"^\d+\.\d+\.\d+(-[0-9A-Za-z.-]+)?(\+[0-9A-Za-z.-]+)?$")] + private static partial Regex SemanticVersion(); +} diff --git a/tests/WalterEgo.Cli.Tests/WalterEgo.Cli.Tests.csproj b/tests/WalterEgo.Cli.Tests/WalterEgo.Cli.Tests.csproj new file mode 100644 index 0000000..3b6acc0 --- /dev/null +++ b/tests/WalterEgo.Cli.Tests/WalterEgo.Cli.Tests.csproj @@ -0,0 +1,7 @@ + + + + + + + diff --git a/tests/WalterEgo.Cli.Tests/packages.lock.json b/tests/WalterEgo.Cli.Tests/packages.lock.json new file mode 100644 index 0000000..f878956 --- /dev/null +++ b/tests/WalterEgo.Cli.Tests/packages.lock.json @@ -0,0 +1,219 @@ +{ + "version": 2, + "dependencies": { + "net10.0": { + "Microsoft.Testing.Extensions.CodeCoverage": { + "type": "Direct", + "requested": "[18.12.0, )", + "resolved": "18.12.0", + "contentHash": "BST/sWYpKk9OXO7Yxktcg6FWORRsHU0EdCbMwZ7d3OqJsMKlrNHIZ30g0Ib4k5T5acJYXRBmg9mNrTU/N6cy1g==", + "dependencies": { + "Microsoft.DiaSymReader": "2.2.10", + "Microsoft.Extensions.DependencyModel": "10.0.10", + "Microsoft.Testing.Platform": "2.5.0", + "Mono.Cecil": "0.11.6" + } + }, + "MinVer": { + "type": "Direct", + "requested": "[8.0.0, )", + "resolved": "8.0.0", + "contentHash": "AJy/KVjXgUbgjf6HiI8wAk4DSSq0SCmvXQF8aU6IB+pnIQq+YJvofvMczug2hqO8yEvnQY557ryew66KPpyCsA==" + }, + "Shouldly": { + "type": "Direct", + "requested": "[4.3.0, )", + "resolved": "4.3.0", + "contentHash": "sDetrWXrl6YXZ4HeLsdBoNk3uIa7K+V4uvIJ+cqdRa5DrFxeTED7VkjoxCuU1kJWpUuBDZz2QXFzSxBtVXLwRQ==", + "dependencies": { + "DiffEngine": "11.3.0", + "EmptyFiles": "4.4.0" + } + }, + "xunit.v3": { + "type": "Direct", + "requested": "[4.0.2, )", + "resolved": "4.0.2", + "contentHash": "TdjM2OAx7w/0E88E6PgaigLoTbQaxbSR3HF/8p92plchTjf29jPHW27ylvEOz+Nx8CvPwWKGQlOR1fDv6/Qh5A==", + "dependencies": { + "xunit.v3.mtp-v2": "[4.0.2]" + } + }, + "DiffEngine": { + "type": "Transitive", + "resolved": "11.3.0", + "contentHash": "k0ZgZqd09jLZQjR8FyQbSQE86Q7QZnjEzq1LPHtj1R2AoWO8sjV5x+jlSisL7NZAbUOI4y+7Bog8gkr9WIRBGw==", + "dependencies": { + "EmptyFiles": "4.4.0", + "System.Management": "6.0.1" + } + }, + "EmptyFiles": { + "type": "Transitive", + "resolved": "4.4.0", + "contentHash": "gwJEfIGS7FhykvtZoscwXj/XwW+mJY6UbAZk+qtLKFUGWC95kfKXnj8VkxsZQnWBxJemM/q664rGLN5nf+OHZw==" + }, + "Microsoft.ApplicationInsights": { + "type": "Transitive", + "resolved": "2.23.0", + "contentHash": "nWArUZTdU7iqZLycLKWe0TDms48KKGE6pONH2terYNa8REXiqixrMOkf1sk5DHGMaUTqONU2YkS4SAXBhLStgw==" + }, + "Microsoft.Bcl.AsyncInterfaces": { + "type": "Transitive", + "resolved": "6.0.0", + "contentHash": "UcSjPsst+DfAdJGVDsu346FX0ci0ah+lw3WRtn18NUwEqRt70HaOQ7lI72vy3+1LxtqI3T5GWwV39rQSrCzAeg==" + }, + "Microsoft.DiaSymReader": { + "type": "Transitive", + "resolved": "2.2.10", + "contentHash": "zmGsm6b2y3STDa/Of7rdkkfTDV8VuGB8aCqIkLoJIQh5tL78K3zJ8OUyFKnfsaORXmGr9iOKwDkZfUjeXi+CwA==" + }, + "Microsoft.Extensions.DependencyModel": { + "type": "Transitive", + "resolved": "10.0.10", + "contentHash": "rfZA1RjR021RPqSmIPovfz2aOd79TGqJ9BengbjnzIISOVwjLmuSDnhCMmiY/1c6iYvGolQ1iNGzkav0u11XEA==" + }, + "Microsoft.Testing.Extensions.Telemetry": { + "type": "Transitive", + "resolved": "2.5.1", + "contentHash": "mu2iyoHovwl0q1mGeeRU0h8+LALXC7HqbxniLa1shTKYdJGl+KPoCEgjWIQ8MLzk1tlTGPOfg1JsxdH3RxhMCA==", + "dependencies": { + "Microsoft.ApplicationInsights": "2.23.0", + "Microsoft.Testing.Platform": "[2.5.1, 3.0.0)" + } + }, + "Microsoft.Testing.Extensions.TrxReport.Abstractions": { + "type": "Transitive", + "resolved": "2.5.1", + "contentHash": "DYTZAguaHz0wNJdHDTTGYOXtnlDoLoIbTMDKSApNNcytm55DJcnwpwELfQGLk5DB5QlgaEjNhnGo1Pu5QvL5VA==", + "dependencies": { + "Microsoft.Testing.Platform": "[2.5.1, 3.0.0)" + } + }, + "Microsoft.Testing.Platform": { + "type": "Transitive", + "resolved": "2.5.1", + "contentHash": "FAMaFFWnULW+hDHMb40Qzhcgz9cAU2/EtgRCBNX/DdQoKo0sPG2EiY+w7bQdl/BgHnf/DbpXLbf5Xy0o15M8NA==" + }, + "Microsoft.Testing.Platform.MSBuild": { + "type": "Transitive", + "resolved": "2.5.1", + "contentHash": "lYawcAwY+h76rQmpma2n0HaL8zkOFbbKapso0Eb+uOAUQn7333pIByLftEuiO67csAoZufHNMwi6PqhNemWQXA==", + "dependencies": { + "Microsoft.Testing.Platform": "[2.5.1, 3.0.0)" + } + }, + "Microsoft.Win32.Registry": { + "type": "Transitive", + "resolved": "5.0.0", + "contentHash": "dDoKi0PnDz31yAyETfRntsLArTlVAVzUzCIvvEDsDsucrl33Dl8pIJG06ePTJTI3tGpeyHS9Cq7Foc/s4EeKcg==" + }, + "Mono.Cecil": { + "type": "Transitive", + "resolved": "0.11.6", + "contentHash": "f33RkDtZO8VlGXCtmQIviOtxgnUdym9xx/b1p9h91CRGOsJFxCFOFK1FDbVt1OCf1aWwYejUFa2MOQyFWTFjbA==" + }, + "System.CodeDom": { + "type": "Transitive", + "resolved": "6.0.0", + "contentHash": "CPc6tWO1LAer3IzfZufDBRL+UZQcj5uS207NHALQzP84Vp/z6wF0Aa0YZImOQY8iStY0A2zI/e3ihKNPfUm8XA==" + }, + "System.Management": { + "type": "Transitive", + "resolved": "6.0.1", + "contentHash": "10J1D0h/lioojphfJ4Fuh5ZUThT/xOVHdV9roGBittKKNP2PMjrvibEdbVTGZcPra1399Ja3tqIJLyQrc5Wmhg==", + "dependencies": { + "System.CodeDom": "6.0.0" + } + }, + "System.Security.AccessControl": { + "type": "Transitive", + "resolved": "6.0.1", + "contentHash": "IQ4NXP/B3Ayzvw0rDQzVTYsCKyy0Jp9KI6aYcK7UnGVlR9+Awz++TIPCQtPYfLJfOpm8ajowMR09V7quD3sEHw==" + }, + "xunit.analyzers": { + "type": "Transitive", + "resolved": "2.2.0", + "contentHash": "dXMIIztipcAyL3a19gtUrih/RLrE33/4VJdICoinYqIXXo1KLtsMPsaQ9dO2pE8xajDguwE2kqVbBqE5/EoJ0Q==" + }, + "xunit.v3.assert": { + "type": "Transitive", + "resolved": "4.0.2", + "contentHash": "5PKRexYlvufWFdXenRcRGKqvaJBBZFJZpqUGlUs9p13eKEgVdOrLpkPknjzUvLY5kEUicK9871DIUDcCPA6AXA==" + }, + "xunit.v3.common": { + "type": "Transitive", + "resolved": "4.0.2", + "contentHash": "++CtT8daIf6qfieQev/8V88U3zViIDWou5cj+oWps1/Hf73UoaY/L0hKyi3v7Zlt3BmbU0pUc73zCB1GiB4nYA==", + "dependencies": { + "Microsoft.Bcl.AsyncInterfaces": "6.0.0" + } + }, + "xunit.v3.core.mtp-v2": { + "type": "Transitive", + "resolved": "4.0.2", + "contentHash": "XyPMcQRsnUQLhmBBRRgYWsuPc8TyiANzcXtqfzyWfDpPuyh3Q0K4oWozZYQKZRNGnqJ97ifD6qUDWhsEEe32uw==", + "dependencies": { + "Microsoft.Testing.Extensions.Telemetry": "2.5.1", + "Microsoft.Testing.Extensions.TrxReport.Abstractions": "2.5.1", + "Microsoft.Testing.Platform": "2.5.1", + "Microsoft.Testing.Platform.MSBuild": "2.5.1", + "xunit.v3.extensibility.core": "[4.0.2]", + "xunit.v3.runner.inproc.console": "[4.0.2]" + } + }, + "xunit.v3.extensibility.core": { + "type": "Transitive", + "resolved": "4.0.2", + "contentHash": "ARTt+pGyd86mdtiFBkKpyBQvRC3u0rr8oidBlII2GsAg7D6TfOsDFCsoQtFij83V5pE57m3whUIqT4xjiARXbQ==", + "dependencies": { + "xunit.v3.common": "[4.0.2]" + } + }, + "xunit.v3.mtp-v2": { + "type": "Transitive", + "resolved": "4.0.2", + "contentHash": "XLV32FhkuvheBStvX0DvjfPEtI+4SOVcIhnlTS+549r8VfVwsjpWdkJtQmQ7D23PA+Zoaqo+sTjBkRSkidC6Tw==", + "dependencies": { + "xunit.analyzers": "2.2.0", + "xunit.v3.assert": "[4.0.2]", + "xunit.v3.core.mtp-v2": "[4.0.2]" + } + }, + "xunit.v3.runner.common": { + "type": "Transitive", + "resolved": "4.0.2", + "contentHash": "YlYKVhTJVcwEgJ6rm59Pjf71lQqKwKxEHqVRxWUuwrwm/nxB/mNFP/lP4vlntDO3GclNnLT9BjYOpJH9gViGQg==", + "dependencies": { + "Microsoft.Win32.Registry": "[5.0.0]", + "System.Security.AccessControl": "[6.0.1]", + "xunit.v3.common": "[4.0.2]" + } + }, + "xunit.v3.runner.inproc.console": { + "type": "Transitive", + "resolved": "4.0.2", + "contentHash": "cg4XNpCN4Ry9nswutknpreN3ckSUBwtjMRmEQSNK/sIKPo6KN5tDGGGCaHDm5HGA4yFVVtTJX65tLCsZArUNfQ==", + "dependencies": { + "xunit.v3.extensibility.core": "[4.0.2]", + "xunit.v3.runner.common": "[4.0.2]" + } + }, + "walterego.cli": { + "type": "Project", + "dependencies": { + "WalterEgo.Generators": "[1.0.0, )" + } + }, + "walterego.core": { + "type": "Project" + }, + "walterego.generators": { + "type": "Project", + "dependencies": { + "WalterEgo.Core": "[1.0.0, )" + } + } + } + } +} \ No newline at end of file diff --git a/tests/WalterEgo.Core.Tests/PackageIdentityTests.cs b/tests/WalterEgo.Core.Tests/PackageIdentityTests.cs new file mode 100644 index 0000000..0568537 --- /dev/null +++ b/tests/WalterEgo.Core.Tests/PackageIdentityTests.cs @@ -0,0 +1,29 @@ +using System.Reflection; +using System.Text.RegularExpressions; + +namespace WalterEgo.Core.Tests; + +public sealed partial class PackageIdentityTests +{ + private const string PackageId = "WalterEgo.Core"; + + private static readonly Assembly PackageAssembly = Assembly.Load(PackageId); + + [Fact] + public void Assembly_name_matches_the_package_id() + { + PackageAssembly.GetName().Name.ShouldBe(PackageId); + } + + [Fact] + public void Assembly_has_a_semantic_informational_version() + { + var version = PackageAssembly.GetCustomAttribute()?.InformationalVersion; + + version.ShouldNotBeNull(); + SemanticVersion().IsMatch(version).ShouldBeTrue(version); + } + + [GeneratedRegex(@"^\d+\.\d+\.\d+(-[0-9A-Za-z.-]+)?(\+[0-9A-Za-z.-]+)?$")] + private static partial Regex SemanticVersion(); +} diff --git a/tests/WalterEgo.Core.Tests/WalterEgo.Core.Tests.csproj b/tests/WalterEgo.Core.Tests/WalterEgo.Core.Tests.csproj new file mode 100644 index 0000000..5f5c9bb --- /dev/null +++ b/tests/WalterEgo.Core.Tests/WalterEgo.Core.Tests.csproj @@ -0,0 +1,7 @@ + + + + + + + diff --git a/tests/WalterEgo.Core.Tests/packages.lock.json b/tests/WalterEgo.Core.Tests/packages.lock.json new file mode 100644 index 0000000..fe1ed32 --- /dev/null +++ b/tests/WalterEgo.Core.Tests/packages.lock.json @@ -0,0 +1,207 @@ +{ + "version": 2, + "dependencies": { + "net10.0": { + "Microsoft.Testing.Extensions.CodeCoverage": { + "type": "Direct", + "requested": "[18.12.0, )", + "resolved": "18.12.0", + "contentHash": "BST/sWYpKk9OXO7Yxktcg6FWORRsHU0EdCbMwZ7d3OqJsMKlrNHIZ30g0Ib4k5T5acJYXRBmg9mNrTU/N6cy1g==", + "dependencies": { + "Microsoft.DiaSymReader": "2.2.10", + "Microsoft.Extensions.DependencyModel": "10.0.10", + "Microsoft.Testing.Platform": "2.5.0", + "Mono.Cecil": "0.11.6" + } + }, + "MinVer": { + "type": "Direct", + "requested": "[8.0.0, )", + "resolved": "8.0.0", + "contentHash": "AJy/KVjXgUbgjf6HiI8wAk4DSSq0SCmvXQF8aU6IB+pnIQq+YJvofvMczug2hqO8yEvnQY557ryew66KPpyCsA==" + }, + "Shouldly": { + "type": "Direct", + "requested": "[4.3.0, )", + "resolved": "4.3.0", + "contentHash": "sDetrWXrl6YXZ4HeLsdBoNk3uIa7K+V4uvIJ+cqdRa5DrFxeTED7VkjoxCuU1kJWpUuBDZz2QXFzSxBtVXLwRQ==", + "dependencies": { + "DiffEngine": "11.3.0", + "EmptyFiles": "4.4.0" + } + }, + "xunit.v3": { + "type": "Direct", + "requested": "[4.0.2, )", + "resolved": "4.0.2", + "contentHash": "TdjM2OAx7w/0E88E6PgaigLoTbQaxbSR3HF/8p92plchTjf29jPHW27ylvEOz+Nx8CvPwWKGQlOR1fDv6/Qh5A==", + "dependencies": { + "xunit.v3.mtp-v2": "[4.0.2]" + } + }, + "DiffEngine": { + "type": "Transitive", + "resolved": "11.3.0", + "contentHash": "k0ZgZqd09jLZQjR8FyQbSQE86Q7QZnjEzq1LPHtj1R2AoWO8sjV5x+jlSisL7NZAbUOI4y+7Bog8gkr9WIRBGw==", + "dependencies": { + "EmptyFiles": "4.4.0", + "System.Management": "6.0.1" + } + }, + "EmptyFiles": { + "type": "Transitive", + "resolved": "4.4.0", + "contentHash": "gwJEfIGS7FhykvtZoscwXj/XwW+mJY6UbAZk+qtLKFUGWC95kfKXnj8VkxsZQnWBxJemM/q664rGLN5nf+OHZw==" + }, + "Microsoft.ApplicationInsights": { + "type": "Transitive", + "resolved": "2.23.0", + "contentHash": "nWArUZTdU7iqZLycLKWe0TDms48KKGE6pONH2terYNa8REXiqixrMOkf1sk5DHGMaUTqONU2YkS4SAXBhLStgw==" + }, + "Microsoft.Bcl.AsyncInterfaces": { + "type": "Transitive", + "resolved": "6.0.0", + "contentHash": "UcSjPsst+DfAdJGVDsu346FX0ci0ah+lw3WRtn18NUwEqRt70HaOQ7lI72vy3+1LxtqI3T5GWwV39rQSrCzAeg==" + }, + "Microsoft.DiaSymReader": { + "type": "Transitive", + "resolved": "2.2.10", + "contentHash": "zmGsm6b2y3STDa/Of7rdkkfTDV8VuGB8aCqIkLoJIQh5tL78K3zJ8OUyFKnfsaORXmGr9iOKwDkZfUjeXi+CwA==" + }, + "Microsoft.Extensions.DependencyModel": { + "type": "Transitive", + "resolved": "10.0.10", + "contentHash": "rfZA1RjR021RPqSmIPovfz2aOd79TGqJ9BengbjnzIISOVwjLmuSDnhCMmiY/1c6iYvGolQ1iNGzkav0u11XEA==" + }, + "Microsoft.Testing.Extensions.Telemetry": { + "type": "Transitive", + "resolved": "2.5.1", + "contentHash": "mu2iyoHovwl0q1mGeeRU0h8+LALXC7HqbxniLa1shTKYdJGl+KPoCEgjWIQ8MLzk1tlTGPOfg1JsxdH3RxhMCA==", + "dependencies": { + "Microsoft.ApplicationInsights": "2.23.0", + "Microsoft.Testing.Platform": "[2.5.1, 3.0.0)" + } + }, + "Microsoft.Testing.Extensions.TrxReport.Abstractions": { + "type": "Transitive", + "resolved": "2.5.1", + "contentHash": "DYTZAguaHz0wNJdHDTTGYOXtnlDoLoIbTMDKSApNNcytm55DJcnwpwELfQGLk5DB5QlgaEjNhnGo1Pu5QvL5VA==", + "dependencies": { + "Microsoft.Testing.Platform": "[2.5.1, 3.0.0)" + } + }, + "Microsoft.Testing.Platform": { + "type": "Transitive", + "resolved": "2.5.1", + "contentHash": "FAMaFFWnULW+hDHMb40Qzhcgz9cAU2/EtgRCBNX/DdQoKo0sPG2EiY+w7bQdl/BgHnf/DbpXLbf5Xy0o15M8NA==" + }, + "Microsoft.Testing.Platform.MSBuild": { + "type": "Transitive", + "resolved": "2.5.1", + "contentHash": "lYawcAwY+h76rQmpma2n0HaL8zkOFbbKapso0Eb+uOAUQn7333pIByLftEuiO67csAoZufHNMwi6PqhNemWQXA==", + "dependencies": { + "Microsoft.Testing.Platform": "[2.5.1, 3.0.0)" + } + }, + "Microsoft.Win32.Registry": { + "type": "Transitive", + "resolved": "5.0.0", + "contentHash": "dDoKi0PnDz31yAyETfRntsLArTlVAVzUzCIvvEDsDsucrl33Dl8pIJG06ePTJTI3tGpeyHS9Cq7Foc/s4EeKcg==" + }, + "Mono.Cecil": { + "type": "Transitive", + "resolved": "0.11.6", + "contentHash": "f33RkDtZO8VlGXCtmQIviOtxgnUdym9xx/b1p9h91CRGOsJFxCFOFK1FDbVt1OCf1aWwYejUFa2MOQyFWTFjbA==" + }, + "System.CodeDom": { + "type": "Transitive", + "resolved": "6.0.0", + "contentHash": "CPc6tWO1LAer3IzfZufDBRL+UZQcj5uS207NHALQzP84Vp/z6wF0Aa0YZImOQY8iStY0A2zI/e3ihKNPfUm8XA==" + }, + "System.Management": { + "type": "Transitive", + "resolved": "6.0.1", + "contentHash": "10J1D0h/lioojphfJ4Fuh5ZUThT/xOVHdV9roGBittKKNP2PMjrvibEdbVTGZcPra1399Ja3tqIJLyQrc5Wmhg==", + "dependencies": { + "System.CodeDom": "6.0.0" + } + }, + "System.Security.AccessControl": { + "type": "Transitive", + "resolved": "6.0.1", + "contentHash": "IQ4NXP/B3Ayzvw0rDQzVTYsCKyy0Jp9KI6aYcK7UnGVlR9+Awz++TIPCQtPYfLJfOpm8ajowMR09V7quD3sEHw==" + }, + "xunit.analyzers": { + "type": "Transitive", + "resolved": "2.2.0", + "contentHash": "dXMIIztipcAyL3a19gtUrih/RLrE33/4VJdICoinYqIXXo1KLtsMPsaQ9dO2pE8xajDguwE2kqVbBqE5/EoJ0Q==" + }, + "xunit.v3.assert": { + "type": "Transitive", + "resolved": "4.0.2", + "contentHash": "5PKRexYlvufWFdXenRcRGKqvaJBBZFJZpqUGlUs9p13eKEgVdOrLpkPknjzUvLY5kEUicK9871DIUDcCPA6AXA==" + }, + "xunit.v3.common": { + "type": "Transitive", + "resolved": "4.0.2", + "contentHash": "++CtT8daIf6qfieQev/8V88U3zViIDWou5cj+oWps1/Hf73UoaY/L0hKyi3v7Zlt3BmbU0pUc73zCB1GiB4nYA==", + "dependencies": { + "Microsoft.Bcl.AsyncInterfaces": "6.0.0" + } + }, + "xunit.v3.core.mtp-v2": { + "type": "Transitive", + "resolved": "4.0.2", + "contentHash": "XyPMcQRsnUQLhmBBRRgYWsuPc8TyiANzcXtqfzyWfDpPuyh3Q0K4oWozZYQKZRNGnqJ97ifD6qUDWhsEEe32uw==", + "dependencies": { + "Microsoft.Testing.Extensions.Telemetry": "2.5.1", + "Microsoft.Testing.Extensions.TrxReport.Abstractions": "2.5.1", + "Microsoft.Testing.Platform": "2.5.1", + "Microsoft.Testing.Platform.MSBuild": "2.5.1", + "xunit.v3.extensibility.core": "[4.0.2]", + "xunit.v3.runner.inproc.console": "[4.0.2]" + } + }, + "xunit.v3.extensibility.core": { + "type": "Transitive", + "resolved": "4.0.2", + "contentHash": "ARTt+pGyd86mdtiFBkKpyBQvRC3u0rr8oidBlII2GsAg7D6TfOsDFCsoQtFij83V5pE57m3whUIqT4xjiARXbQ==", + "dependencies": { + "xunit.v3.common": "[4.0.2]" + } + }, + "xunit.v3.mtp-v2": { + "type": "Transitive", + "resolved": "4.0.2", + "contentHash": "XLV32FhkuvheBStvX0DvjfPEtI+4SOVcIhnlTS+549r8VfVwsjpWdkJtQmQ7D23PA+Zoaqo+sTjBkRSkidC6Tw==", + "dependencies": { + "xunit.analyzers": "2.2.0", + "xunit.v3.assert": "[4.0.2]", + "xunit.v3.core.mtp-v2": "[4.0.2]" + } + }, + "xunit.v3.runner.common": { + "type": "Transitive", + "resolved": "4.0.2", + "contentHash": "YlYKVhTJVcwEgJ6rm59Pjf71lQqKwKxEHqVRxWUuwrwm/nxB/mNFP/lP4vlntDO3GclNnLT9BjYOpJH9gViGQg==", + "dependencies": { + "Microsoft.Win32.Registry": "[5.0.0]", + "System.Security.AccessControl": "[6.0.1]", + "xunit.v3.common": "[4.0.2]" + } + }, + "xunit.v3.runner.inproc.console": { + "type": "Transitive", + "resolved": "4.0.2", + "contentHash": "cg4XNpCN4Ry9nswutknpreN3ckSUBwtjMRmEQSNK/sIKPo6KN5tDGGGCaHDm5HGA4yFVVtTJX65tLCsZArUNfQ==", + "dependencies": { + "xunit.v3.extensibility.core": "[4.0.2]", + "xunit.v3.runner.common": "[4.0.2]" + } + }, + "walterego.core": { + "type": "Project" + } + } + } +} \ No newline at end of file diff --git a/tests/WalterEgo.EntityFrameworkCore.Tests/PackageIdentityTests.cs b/tests/WalterEgo.EntityFrameworkCore.Tests/PackageIdentityTests.cs new file mode 100644 index 0000000..34489c9 --- /dev/null +++ b/tests/WalterEgo.EntityFrameworkCore.Tests/PackageIdentityTests.cs @@ -0,0 +1,29 @@ +using System.Reflection; +using System.Text.RegularExpressions; + +namespace WalterEgo.EntityFrameworkCore.Tests; + +public sealed partial class PackageIdentityTests +{ + private const string PackageId = "WalterEgo.EntityFrameworkCore"; + + private static readonly Assembly PackageAssembly = Assembly.Load(PackageId); + + [Fact] + public void Assembly_name_matches_the_package_id() + { + PackageAssembly.GetName().Name.ShouldBe(PackageId); + } + + [Fact] + public void Assembly_has_a_semantic_informational_version() + { + var version = PackageAssembly.GetCustomAttribute()?.InformationalVersion; + + version.ShouldNotBeNull(); + SemanticVersion().IsMatch(version).ShouldBeTrue(version); + } + + [GeneratedRegex(@"^\d+\.\d+\.\d+(-[0-9A-Za-z.-]+)?(\+[0-9A-Za-z.-]+)?$")] + private static partial Regex SemanticVersion(); +} diff --git a/tests/WalterEgo.EntityFrameworkCore.Tests/WalterEgo.EntityFrameworkCore.Tests.csproj b/tests/WalterEgo.EntityFrameworkCore.Tests/WalterEgo.EntityFrameworkCore.Tests.csproj new file mode 100644 index 0000000..91f4e35 --- /dev/null +++ b/tests/WalterEgo.EntityFrameworkCore.Tests/WalterEgo.EntityFrameworkCore.Tests.csproj @@ -0,0 +1,7 @@ + + + + + + + diff --git a/tests/WalterEgo.EntityFrameworkCore.Tests/packages.lock.json b/tests/WalterEgo.EntityFrameworkCore.Tests/packages.lock.json new file mode 100644 index 0000000..4e3a59f --- /dev/null +++ b/tests/WalterEgo.EntityFrameworkCore.Tests/packages.lock.json @@ -0,0 +1,213 @@ +{ + "version": 2, + "dependencies": { + "net10.0": { + "Microsoft.Testing.Extensions.CodeCoverage": { + "type": "Direct", + "requested": "[18.12.0, )", + "resolved": "18.12.0", + "contentHash": "BST/sWYpKk9OXO7Yxktcg6FWORRsHU0EdCbMwZ7d3OqJsMKlrNHIZ30g0Ib4k5T5acJYXRBmg9mNrTU/N6cy1g==", + "dependencies": { + "Microsoft.DiaSymReader": "2.2.10", + "Microsoft.Extensions.DependencyModel": "10.0.10", + "Microsoft.Testing.Platform": "2.5.0", + "Mono.Cecil": "0.11.6" + } + }, + "MinVer": { + "type": "Direct", + "requested": "[8.0.0, )", + "resolved": "8.0.0", + "contentHash": "AJy/KVjXgUbgjf6HiI8wAk4DSSq0SCmvXQF8aU6IB+pnIQq+YJvofvMczug2hqO8yEvnQY557ryew66KPpyCsA==" + }, + "Shouldly": { + "type": "Direct", + "requested": "[4.3.0, )", + "resolved": "4.3.0", + "contentHash": "sDetrWXrl6YXZ4HeLsdBoNk3uIa7K+V4uvIJ+cqdRa5DrFxeTED7VkjoxCuU1kJWpUuBDZz2QXFzSxBtVXLwRQ==", + "dependencies": { + "DiffEngine": "11.3.0", + "EmptyFiles": "4.4.0" + } + }, + "xunit.v3": { + "type": "Direct", + "requested": "[4.0.2, )", + "resolved": "4.0.2", + "contentHash": "TdjM2OAx7w/0E88E6PgaigLoTbQaxbSR3HF/8p92plchTjf29jPHW27ylvEOz+Nx8CvPwWKGQlOR1fDv6/Qh5A==", + "dependencies": { + "xunit.v3.mtp-v2": "[4.0.2]" + } + }, + "DiffEngine": { + "type": "Transitive", + "resolved": "11.3.0", + "contentHash": "k0ZgZqd09jLZQjR8FyQbSQE86Q7QZnjEzq1LPHtj1R2AoWO8sjV5x+jlSisL7NZAbUOI4y+7Bog8gkr9WIRBGw==", + "dependencies": { + "EmptyFiles": "4.4.0", + "System.Management": "6.0.1" + } + }, + "EmptyFiles": { + "type": "Transitive", + "resolved": "4.4.0", + "contentHash": "gwJEfIGS7FhykvtZoscwXj/XwW+mJY6UbAZk+qtLKFUGWC95kfKXnj8VkxsZQnWBxJemM/q664rGLN5nf+OHZw==" + }, + "Microsoft.ApplicationInsights": { + "type": "Transitive", + "resolved": "2.23.0", + "contentHash": "nWArUZTdU7iqZLycLKWe0TDms48KKGE6pONH2terYNa8REXiqixrMOkf1sk5DHGMaUTqONU2YkS4SAXBhLStgw==" + }, + "Microsoft.Bcl.AsyncInterfaces": { + "type": "Transitive", + "resolved": "6.0.0", + "contentHash": "UcSjPsst+DfAdJGVDsu346FX0ci0ah+lw3WRtn18NUwEqRt70HaOQ7lI72vy3+1LxtqI3T5GWwV39rQSrCzAeg==" + }, + "Microsoft.DiaSymReader": { + "type": "Transitive", + "resolved": "2.2.10", + "contentHash": "zmGsm6b2y3STDa/Of7rdkkfTDV8VuGB8aCqIkLoJIQh5tL78K3zJ8OUyFKnfsaORXmGr9iOKwDkZfUjeXi+CwA==" + }, + "Microsoft.Extensions.DependencyModel": { + "type": "Transitive", + "resolved": "10.0.10", + "contentHash": "rfZA1RjR021RPqSmIPovfz2aOd79TGqJ9BengbjnzIISOVwjLmuSDnhCMmiY/1c6iYvGolQ1iNGzkav0u11XEA==" + }, + "Microsoft.Testing.Extensions.Telemetry": { + "type": "Transitive", + "resolved": "2.5.1", + "contentHash": "mu2iyoHovwl0q1mGeeRU0h8+LALXC7HqbxniLa1shTKYdJGl+KPoCEgjWIQ8MLzk1tlTGPOfg1JsxdH3RxhMCA==", + "dependencies": { + "Microsoft.ApplicationInsights": "2.23.0", + "Microsoft.Testing.Platform": "[2.5.1, 3.0.0)" + } + }, + "Microsoft.Testing.Extensions.TrxReport.Abstractions": { + "type": "Transitive", + "resolved": "2.5.1", + "contentHash": "DYTZAguaHz0wNJdHDTTGYOXtnlDoLoIbTMDKSApNNcytm55DJcnwpwELfQGLk5DB5QlgaEjNhnGo1Pu5QvL5VA==", + "dependencies": { + "Microsoft.Testing.Platform": "[2.5.1, 3.0.0)" + } + }, + "Microsoft.Testing.Platform": { + "type": "Transitive", + "resolved": "2.5.1", + "contentHash": "FAMaFFWnULW+hDHMb40Qzhcgz9cAU2/EtgRCBNX/DdQoKo0sPG2EiY+w7bQdl/BgHnf/DbpXLbf5Xy0o15M8NA==" + }, + "Microsoft.Testing.Platform.MSBuild": { + "type": "Transitive", + "resolved": "2.5.1", + "contentHash": "lYawcAwY+h76rQmpma2n0HaL8zkOFbbKapso0Eb+uOAUQn7333pIByLftEuiO67csAoZufHNMwi6PqhNemWQXA==", + "dependencies": { + "Microsoft.Testing.Platform": "[2.5.1, 3.0.0)" + } + }, + "Microsoft.Win32.Registry": { + "type": "Transitive", + "resolved": "5.0.0", + "contentHash": "dDoKi0PnDz31yAyETfRntsLArTlVAVzUzCIvvEDsDsucrl33Dl8pIJG06ePTJTI3tGpeyHS9Cq7Foc/s4EeKcg==" + }, + "Mono.Cecil": { + "type": "Transitive", + "resolved": "0.11.6", + "contentHash": "f33RkDtZO8VlGXCtmQIviOtxgnUdym9xx/b1p9h91CRGOsJFxCFOFK1FDbVt1OCf1aWwYejUFa2MOQyFWTFjbA==" + }, + "System.CodeDom": { + "type": "Transitive", + "resolved": "6.0.0", + "contentHash": "CPc6tWO1LAer3IzfZufDBRL+UZQcj5uS207NHALQzP84Vp/z6wF0Aa0YZImOQY8iStY0A2zI/e3ihKNPfUm8XA==" + }, + "System.Management": { + "type": "Transitive", + "resolved": "6.0.1", + "contentHash": "10J1D0h/lioojphfJ4Fuh5ZUThT/xOVHdV9roGBittKKNP2PMjrvibEdbVTGZcPra1399Ja3tqIJLyQrc5Wmhg==", + "dependencies": { + "System.CodeDom": "6.0.0" + } + }, + "System.Security.AccessControl": { + "type": "Transitive", + "resolved": "6.0.1", + "contentHash": "IQ4NXP/B3Ayzvw0rDQzVTYsCKyy0Jp9KI6aYcK7UnGVlR9+Awz++TIPCQtPYfLJfOpm8ajowMR09V7quD3sEHw==" + }, + "xunit.analyzers": { + "type": "Transitive", + "resolved": "2.2.0", + "contentHash": "dXMIIztipcAyL3a19gtUrih/RLrE33/4VJdICoinYqIXXo1KLtsMPsaQ9dO2pE8xajDguwE2kqVbBqE5/EoJ0Q==" + }, + "xunit.v3.assert": { + "type": "Transitive", + "resolved": "4.0.2", + "contentHash": "5PKRexYlvufWFdXenRcRGKqvaJBBZFJZpqUGlUs9p13eKEgVdOrLpkPknjzUvLY5kEUicK9871DIUDcCPA6AXA==" + }, + "xunit.v3.common": { + "type": "Transitive", + "resolved": "4.0.2", + "contentHash": "++CtT8daIf6qfieQev/8V88U3zViIDWou5cj+oWps1/Hf73UoaY/L0hKyi3v7Zlt3BmbU0pUc73zCB1GiB4nYA==", + "dependencies": { + "Microsoft.Bcl.AsyncInterfaces": "6.0.0" + } + }, + "xunit.v3.core.mtp-v2": { + "type": "Transitive", + "resolved": "4.0.2", + "contentHash": "XyPMcQRsnUQLhmBBRRgYWsuPc8TyiANzcXtqfzyWfDpPuyh3Q0K4oWozZYQKZRNGnqJ97ifD6qUDWhsEEe32uw==", + "dependencies": { + "Microsoft.Testing.Extensions.Telemetry": "2.5.1", + "Microsoft.Testing.Extensions.TrxReport.Abstractions": "2.5.1", + "Microsoft.Testing.Platform": "2.5.1", + "Microsoft.Testing.Platform.MSBuild": "2.5.1", + "xunit.v3.extensibility.core": "[4.0.2]", + "xunit.v3.runner.inproc.console": "[4.0.2]" + } + }, + "xunit.v3.extensibility.core": { + "type": "Transitive", + "resolved": "4.0.2", + "contentHash": "ARTt+pGyd86mdtiFBkKpyBQvRC3u0rr8oidBlII2GsAg7D6TfOsDFCsoQtFij83V5pE57m3whUIqT4xjiARXbQ==", + "dependencies": { + "xunit.v3.common": "[4.0.2]" + } + }, + "xunit.v3.mtp-v2": { + "type": "Transitive", + "resolved": "4.0.2", + "contentHash": "XLV32FhkuvheBStvX0DvjfPEtI+4SOVcIhnlTS+549r8VfVwsjpWdkJtQmQ7D23PA+Zoaqo+sTjBkRSkidC6Tw==", + "dependencies": { + "xunit.analyzers": "2.2.0", + "xunit.v3.assert": "[4.0.2]", + "xunit.v3.core.mtp-v2": "[4.0.2]" + } + }, + "xunit.v3.runner.common": { + "type": "Transitive", + "resolved": "4.0.2", + "contentHash": "YlYKVhTJVcwEgJ6rm59Pjf71lQqKwKxEHqVRxWUuwrwm/nxB/mNFP/lP4vlntDO3GclNnLT9BjYOpJH9gViGQg==", + "dependencies": { + "Microsoft.Win32.Registry": "[5.0.0]", + "System.Security.AccessControl": "[6.0.1]", + "xunit.v3.common": "[4.0.2]" + } + }, + "xunit.v3.runner.inproc.console": { + "type": "Transitive", + "resolved": "4.0.2", + "contentHash": "cg4XNpCN4Ry9nswutknpreN3ckSUBwtjMRmEQSNK/sIKPo6KN5tDGGGCaHDm5HGA4yFVVtTJX65tLCsZArUNfQ==", + "dependencies": { + "xunit.v3.extensibility.core": "[4.0.2]", + "xunit.v3.runner.common": "[4.0.2]" + } + }, + "walterego.core": { + "type": "Project" + }, + "walterego.entityframeworkcore": { + "type": "Project", + "dependencies": { + "WalterEgo.Core": "[1.0.0, )" + } + } + } + } +} \ No newline at end of file diff --git a/tests/WalterEgo.Generators.Tests/PackageIdentityTests.cs b/tests/WalterEgo.Generators.Tests/PackageIdentityTests.cs new file mode 100644 index 0000000..0a58bc4 --- /dev/null +++ b/tests/WalterEgo.Generators.Tests/PackageIdentityTests.cs @@ -0,0 +1,29 @@ +using System.Reflection; +using System.Text.RegularExpressions; + +namespace WalterEgo.Generators.Tests; + +public sealed partial class PackageIdentityTests +{ + private const string PackageId = "WalterEgo.Generators"; + + private static readonly Assembly PackageAssembly = Assembly.Load(PackageId); + + [Fact] + public void Assembly_name_matches_the_package_id() + { + PackageAssembly.GetName().Name.ShouldBe(PackageId); + } + + [Fact] + public void Assembly_has_a_semantic_informational_version() + { + var version = PackageAssembly.GetCustomAttribute()?.InformationalVersion; + + version.ShouldNotBeNull(); + SemanticVersion().IsMatch(version).ShouldBeTrue(version); + } + + [GeneratedRegex(@"^\d+\.\d+\.\d+(-[0-9A-Za-z.-]+)?(\+[0-9A-Za-z.-]+)?$")] + private static partial Regex SemanticVersion(); +} diff --git a/tests/WalterEgo.Generators.Tests/WalterEgo.Generators.Tests.csproj b/tests/WalterEgo.Generators.Tests/WalterEgo.Generators.Tests.csproj new file mode 100644 index 0000000..f1fa126 --- /dev/null +++ b/tests/WalterEgo.Generators.Tests/WalterEgo.Generators.Tests.csproj @@ -0,0 +1,7 @@ + + + + + + + diff --git a/tests/WalterEgo.Generators.Tests/packages.lock.json b/tests/WalterEgo.Generators.Tests/packages.lock.json new file mode 100644 index 0000000..b146aed --- /dev/null +++ b/tests/WalterEgo.Generators.Tests/packages.lock.json @@ -0,0 +1,213 @@ +{ + "version": 2, + "dependencies": { + "net10.0": { + "Microsoft.Testing.Extensions.CodeCoverage": { + "type": "Direct", + "requested": "[18.12.0, )", + "resolved": "18.12.0", + "contentHash": "BST/sWYpKk9OXO7Yxktcg6FWORRsHU0EdCbMwZ7d3OqJsMKlrNHIZ30g0Ib4k5T5acJYXRBmg9mNrTU/N6cy1g==", + "dependencies": { + "Microsoft.DiaSymReader": "2.2.10", + "Microsoft.Extensions.DependencyModel": "10.0.10", + "Microsoft.Testing.Platform": "2.5.0", + "Mono.Cecil": "0.11.6" + } + }, + "MinVer": { + "type": "Direct", + "requested": "[8.0.0, )", + "resolved": "8.0.0", + "contentHash": "AJy/KVjXgUbgjf6HiI8wAk4DSSq0SCmvXQF8aU6IB+pnIQq+YJvofvMczug2hqO8yEvnQY557ryew66KPpyCsA==" + }, + "Shouldly": { + "type": "Direct", + "requested": "[4.3.0, )", + "resolved": "4.3.0", + "contentHash": "sDetrWXrl6YXZ4HeLsdBoNk3uIa7K+V4uvIJ+cqdRa5DrFxeTED7VkjoxCuU1kJWpUuBDZz2QXFzSxBtVXLwRQ==", + "dependencies": { + "DiffEngine": "11.3.0", + "EmptyFiles": "4.4.0" + } + }, + "xunit.v3": { + "type": "Direct", + "requested": "[4.0.2, )", + "resolved": "4.0.2", + "contentHash": "TdjM2OAx7w/0E88E6PgaigLoTbQaxbSR3HF/8p92plchTjf29jPHW27ylvEOz+Nx8CvPwWKGQlOR1fDv6/Qh5A==", + "dependencies": { + "xunit.v3.mtp-v2": "[4.0.2]" + } + }, + "DiffEngine": { + "type": "Transitive", + "resolved": "11.3.0", + "contentHash": "k0ZgZqd09jLZQjR8FyQbSQE86Q7QZnjEzq1LPHtj1R2AoWO8sjV5x+jlSisL7NZAbUOI4y+7Bog8gkr9WIRBGw==", + "dependencies": { + "EmptyFiles": "4.4.0", + "System.Management": "6.0.1" + } + }, + "EmptyFiles": { + "type": "Transitive", + "resolved": "4.4.0", + "contentHash": "gwJEfIGS7FhykvtZoscwXj/XwW+mJY6UbAZk+qtLKFUGWC95kfKXnj8VkxsZQnWBxJemM/q664rGLN5nf+OHZw==" + }, + "Microsoft.ApplicationInsights": { + "type": "Transitive", + "resolved": "2.23.0", + "contentHash": "nWArUZTdU7iqZLycLKWe0TDms48KKGE6pONH2terYNa8REXiqixrMOkf1sk5DHGMaUTqONU2YkS4SAXBhLStgw==" + }, + "Microsoft.Bcl.AsyncInterfaces": { + "type": "Transitive", + "resolved": "6.0.0", + "contentHash": "UcSjPsst+DfAdJGVDsu346FX0ci0ah+lw3WRtn18NUwEqRt70HaOQ7lI72vy3+1LxtqI3T5GWwV39rQSrCzAeg==" + }, + "Microsoft.DiaSymReader": { + "type": "Transitive", + "resolved": "2.2.10", + "contentHash": "zmGsm6b2y3STDa/Of7rdkkfTDV8VuGB8aCqIkLoJIQh5tL78K3zJ8OUyFKnfsaORXmGr9iOKwDkZfUjeXi+CwA==" + }, + "Microsoft.Extensions.DependencyModel": { + "type": "Transitive", + "resolved": "10.0.10", + "contentHash": "rfZA1RjR021RPqSmIPovfz2aOd79TGqJ9BengbjnzIISOVwjLmuSDnhCMmiY/1c6iYvGolQ1iNGzkav0u11XEA==" + }, + "Microsoft.Testing.Extensions.Telemetry": { + "type": "Transitive", + "resolved": "2.5.1", + "contentHash": "mu2iyoHovwl0q1mGeeRU0h8+LALXC7HqbxniLa1shTKYdJGl+KPoCEgjWIQ8MLzk1tlTGPOfg1JsxdH3RxhMCA==", + "dependencies": { + "Microsoft.ApplicationInsights": "2.23.0", + "Microsoft.Testing.Platform": "[2.5.1, 3.0.0)" + } + }, + "Microsoft.Testing.Extensions.TrxReport.Abstractions": { + "type": "Transitive", + "resolved": "2.5.1", + "contentHash": "DYTZAguaHz0wNJdHDTTGYOXtnlDoLoIbTMDKSApNNcytm55DJcnwpwELfQGLk5DB5QlgaEjNhnGo1Pu5QvL5VA==", + "dependencies": { + "Microsoft.Testing.Platform": "[2.5.1, 3.0.0)" + } + }, + "Microsoft.Testing.Platform": { + "type": "Transitive", + "resolved": "2.5.1", + "contentHash": "FAMaFFWnULW+hDHMb40Qzhcgz9cAU2/EtgRCBNX/DdQoKo0sPG2EiY+w7bQdl/BgHnf/DbpXLbf5Xy0o15M8NA==" + }, + "Microsoft.Testing.Platform.MSBuild": { + "type": "Transitive", + "resolved": "2.5.1", + "contentHash": "lYawcAwY+h76rQmpma2n0HaL8zkOFbbKapso0Eb+uOAUQn7333pIByLftEuiO67csAoZufHNMwi6PqhNemWQXA==", + "dependencies": { + "Microsoft.Testing.Platform": "[2.5.1, 3.0.0)" + } + }, + "Microsoft.Win32.Registry": { + "type": "Transitive", + "resolved": "5.0.0", + "contentHash": "dDoKi0PnDz31yAyETfRntsLArTlVAVzUzCIvvEDsDsucrl33Dl8pIJG06ePTJTI3tGpeyHS9Cq7Foc/s4EeKcg==" + }, + "Mono.Cecil": { + "type": "Transitive", + "resolved": "0.11.6", + "contentHash": "f33RkDtZO8VlGXCtmQIviOtxgnUdym9xx/b1p9h91CRGOsJFxCFOFK1FDbVt1OCf1aWwYejUFa2MOQyFWTFjbA==" + }, + "System.CodeDom": { + "type": "Transitive", + "resolved": "6.0.0", + "contentHash": "CPc6tWO1LAer3IzfZufDBRL+UZQcj5uS207NHALQzP84Vp/z6wF0Aa0YZImOQY8iStY0A2zI/e3ihKNPfUm8XA==" + }, + "System.Management": { + "type": "Transitive", + "resolved": "6.0.1", + "contentHash": "10J1D0h/lioojphfJ4Fuh5ZUThT/xOVHdV9roGBittKKNP2PMjrvibEdbVTGZcPra1399Ja3tqIJLyQrc5Wmhg==", + "dependencies": { + "System.CodeDom": "6.0.0" + } + }, + "System.Security.AccessControl": { + "type": "Transitive", + "resolved": "6.0.1", + "contentHash": "IQ4NXP/B3Ayzvw0rDQzVTYsCKyy0Jp9KI6aYcK7UnGVlR9+Awz++TIPCQtPYfLJfOpm8ajowMR09V7quD3sEHw==" + }, + "xunit.analyzers": { + "type": "Transitive", + "resolved": "2.2.0", + "contentHash": "dXMIIztipcAyL3a19gtUrih/RLrE33/4VJdICoinYqIXXo1KLtsMPsaQ9dO2pE8xajDguwE2kqVbBqE5/EoJ0Q==" + }, + "xunit.v3.assert": { + "type": "Transitive", + "resolved": "4.0.2", + "contentHash": "5PKRexYlvufWFdXenRcRGKqvaJBBZFJZpqUGlUs9p13eKEgVdOrLpkPknjzUvLY5kEUicK9871DIUDcCPA6AXA==" + }, + "xunit.v3.common": { + "type": "Transitive", + "resolved": "4.0.2", + "contentHash": "++CtT8daIf6qfieQev/8V88U3zViIDWou5cj+oWps1/Hf73UoaY/L0hKyi3v7Zlt3BmbU0pUc73zCB1GiB4nYA==", + "dependencies": { + "Microsoft.Bcl.AsyncInterfaces": "6.0.0" + } + }, + "xunit.v3.core.mtp-v2": { + "type": "Transitive", + "resolved": "4.0.2", + "contentHash": "XyPMcQRsnUQLhmBBRRgYWsuPc8TyiANzcXtqfzyWfDpPuyh3Q0K4oWozZYQKZRNGnqJ97ifD6qUDWhsEEe32uw==", + "dependencies": { + "Microsoft.Testing.Extensions.Telemetry": "2.5.1", + "Microsoft.Testing.Extensions.TrxReport.Abstractions": "2.5.1", + "Microsoft.Testing.Platform": "2.5.1", + "Microsoft.Testing.Platform.MSBuild": "2.5.1", + "xunit.v3.extensibility.core": "[4.0.2]", + "xunit.v3.runner.inproc.console": "[4.0.2]" + } + }, + "xunit.v3.extensibility.core": { + "type": "Transitive", + "resolved": "4.0.2", + "contentHash": "ARTt+pGyd86mdtiFBkKpyBQvRC3u0rr8oidBlII2GsAg7D6TfOsDFCsoQtFij83V5pE57m3whUIqT4xjiARXbQ==", + "dependencies": { + "xunit.v3.common": "[4.0.2]" + } + }, + "xunit.v3.mtp-v2": { + "type": "Transitive", + "resolved": "4.0.2", + "contentHash": "XLV32FhkuvheBStvX0DvjfPEtI+4SOVcIhnlTS+549r8VfVwsjpWdkJtQmQ7D23PA+Zoaqo+sTjBkRSkidC6Tw==", + "dependencies": { + "xunit.analyzers": "2.2.0", + "xunit.v3.assert": "[4.0.2]", + "xunit.v3.core.mtp-v2": "[4.0.2]" + } + }, + "xunit.v3.runner.common": { + "type": "Transitive", + "resolved": "4.0.2", + "contentHash": "YlYKVhTJVcwEgJ6rm59Pjf71lQqKwKxEHqVRxWUuwrwm/nxB/mNFP/lP4vlntDO3GclNnLT9BjYOpJH9gViGQg==", + "dependencies": { + "Microsoft.Win32.Registry": "[5.0.0]", + "System.Security.AccessControl": "[6.0.1]", + "xunit.v3.common": "[4.0.2]" + } + }, + "xunit.v3.runner.inproc.console": { + "type": "Transitive", + "resolved": "4.0.2", + "contentHash": "cg4XNpCN4Ry9nswutknpreN3ckSUBwtjMRmEQSNK/sIKPo6KN5tDGGGCaHDm5HGA4yFVVtTJX65tLCsZArUNfQ==", + "dependencies": { + "xunit.v3.extensibility.core": "[4.0.2]", + "xunit.v3.runner.common": "[4.0.2]" + } + }, + "walterego.core": { + "type": "Project" + }, + "walterego.generators": { + "type": "Project", + "dependencies": { + "WalterEgo.Core": "[1.0.0, )" + } + } + } + } +} \ No newline at end of file From a23d0f19855e2e9cfd77c780dbbbeb260feefda8 Mon Sep 17 00:00:00 2001 From: net0well Date: Wed, 21 Oct 2026 17:32:17 -0300 Subject: [PATCH 2/4] test: add repository architecture tests --- eng/contract-paths.txt | 4 + eng/dependency-allowlist.json | 48 +++++ eng/internal-references.allowlist | 6 + eng/internal-references.patterns | 7 + .../AnalyzerWiringTests.cs | 68 ++++++ .../BuildSettingsTests.cs | 81 +++++++ .../ContractPathsTests.cs | 15 ++ .../DependencyAllowlistTests.cs | 93 ++++++++ .../InternalReferenceTests.cs | 58 +++++ .../NuGetConfigTests.cs | 25 +++ .../RepositoryFilesTests.cs | 34 +++ .../RepositoryHygieneTests.cs | 18 ++ .../SolutionInventoryTests.cs | 21 ++ .../Support/Git.cs | 39 ++++ .../Support/InternalReferenceScanner.cs | 59 +++++ .../Support/MsBuild.cs | 84 ++++++++ .../Support/ProcessRunner.cs | 36 ++++ .../Support/ProjectCatalog.cs | 52 +++++ .../Support/Repository.cs | 27 +++ .../Support/WorkflowFile.cs | 80 +++++++ .../WalterEgo.Architecture.Tests.csproj | 2 + .../WorkflowTests.cs | 114 ++++++++++ .../packages.lock.json | 204 ++++++++++++++++++ 23 files changed, 1175 insertions(+) create mode 100644 eng/contract-paths.txt create mode 100644 eng/dependency-allowlist.json create mode 100644 eng/internal-references.allowlist create mode 100644 eng/internal-references.patterns create mode 100644 tests/WalterEgo.Architecture.Tests/AnalyzerWiringTests.cs create mode 100644 tests/WalterEgo.Architecture.Tests/BuildSettingsTests.cs create mode 100644 tests/WalterEgo.Architecture.Tests/ContractPathsTests.cs create mode 100644 tests/WalterEgo.Architecture.Tests/DependencyAllowlistTests.cs create mode 100644 tests/WalterEgo.Architecture.Tests/InternalReferenceTests.cs create mode 100644 tests/WalterEgo.Architecture.Tests/NuGetConfigTests.cs create mode 100644 tests/WalterEgo.Architecture.Tests/RepositoryFilesTests.cs create mode 100644 tests/WalterEgo.Architecture.Tests/RepositoryHygieneTests.cs create mode 100644 tests/WalterEgo.Architecture.Tests/SolutionInventoryTests.cs create mode 100644 tests/WalterEgo.Architecture.Tests/Support/Git.cs create mode 100644 tests/WalterEgo.Architecture.Tests/Support/InternalReferenceScanner.cs create mode 100644 tests/WalterEgo.Architecture.Tests/Support/MsBuild.cs create mode 100644 tests/WalterEgo.Architecture.Tests/Support/ProcessRunner.cs create mode 100644 tests/WalterEgo.Architecture.Tests/Support/ProjectCatalog.cs create mode 100644 tests/WalterEgo.Architecture.Tests/Support/Repository.cs create mode 100644 tests/WalterEgo.Architecture.Tests/Support/WorkflowFile.cs create mode 100644 tests/WalterEgo.Architecture.Tests/WalterEgo.Architecture.Tests.csproj create mode 100644 tests/WalterEgo.Architecture.Tests/WorkflowTests.cs create mode 100644 tests/WalterEgo.Architecture.Tests/packages.lock.json diff --git a/eng/contract-paths.txt b/eng/contract-paths.txt new file mode 100644 index 0000000..17c88e0 --- /dev/null +++ b/eng/contract-paths.txt @@ -0,0 +1,4 @@ +# Changes to these paths are contract changes (public API, events, configuration, CLI). +# A pull request that changes any of them must also change samples/, unless the maintainer applies no-sample-impact. +src/**/PublicAPI.*.txt +schemas/** diff --git a/eng/dependency-allowlist.json b/eng/dependency-allowlist.json new file mode 100644 index 0000000..4847fe0 --- /dev/null +++ b/eng/dependency-allowlist.json @@ -0,0 +1,48 @@ +{ + "buildOnly": [ + "MinVer", + "Microsoft.CodeAnalysis.PublicApiAnalyzers", + "Microsoft.CodeAnalysis.BannedApiAnalyzers", + "Microsoft.NET.ILLink.Tasks" + ], + "baseFrameworks": [ + "Microsoft.NETCore.App" + ], + "projects": { + "WalterEgo.Core": { + "packages": [], + "projects": [], + "frameworks": [] + }, + "WalterEgo.AspNetCore": { + "packages": [], + "projects": ["WalterEgo.Core"], + "frameworks": [] + }, + "WalterEgo.AspNetCore.Identity": { + "packages": [], + "projects": ["WalterEgo.AspNetCore", "WalterEgo.Core"], + "frameworks": [] + }, + "WalterEgo.EntityFrameworkCore": { + "packages": [], + "projects": ["WalterEgo.Core"], + "frameworks": [] + }, + "WalterEgo.Alerting.Webhook": { + "packages": [], + "projects": ["WalterEgo.Core"], + "frameworks": [] + }, + "WalterEgo.Generators": { + "packages": [], + "projects": ["WalterEgo.Core"], + "frameworks": [] + }, + "WalterEgo.Cli": { + "packages": [], + "projects": ["WalterEgo.Generators", "WalterEgo.Core"], + "frameworks": [] + } + } +} diff --git a/eng/internal-references.allowlist b/eng/internal-references.allowlist new file mode 100644 index 0000000..c6ce233 --- /dev/null +++ b/eng/internal-references.allowlist @@ -0,0 +1,6 @@ +# Accepted occurrences of the patterns in internal-references.patterns. +# Format: path | excerpt | reason. Use * as the excerpt to accept a whole file. +eng/internal-references.patterns | * | defines the patterns +eng/internal-references.allowlist | * | lists the accepted occurrences +.gitignore | /docs/ | keeps the local-only documentation folder out of the repository +tests/WalterEgo.Architecture.Tests/InternalReferenceTests.cs | * | exercises the scanner with sample occurrences diff --git a/eng/internal-references.patterns b/eng/internal-references.patterns new file mode 100644 index 0000000..ab1f3d8 --- /dev/null +++ b/eng/internal-references.patterns @@ -0,0 +1,7 @@ +# One PCRE-compatible regular expression per line. Shared by the repository tests and the CI commit message check. +(?i)\bspec\s*#?\d{3}\b +\bAC-\d+\b +\bD-\d{2,}\b +(?i)\b(?:milestone|marco|phase|fase)\s*M?[0-6]\b +(?i)\bM[0-6]\s+(?:milestone|marco|phase|fase)\b +(? SourceProjects => ProjectCatalog.SourceNames(); + + [Theory] + [MemberData(nameof(SourceProjects))] + public async Task Public_api_files_are_wired_into_every_src_project(string projectName) + { + var project = ProjectCatalog.Get(projectName); + var evaluation = await MsBuild.EvaluateAsync(project); + var additionalFiles = evaluation.Items("AdditionalFiles").Select(item => Path.GetFullPath(item.FullPath)).ToList(); + + foreach (var fileName in new[] { "PublicAPI.Shipped.txt", "PublicAPI.Unshipped.txt" }) + { + var path = Repository.PathOf($"{project.RelativeDirectory}/{fileName}"); + File.Exists(path).ShouldBeTrue($"{project.Name} has no {fileName}"); + File.ReadLines(path).First().ShouldBe("#nullable enable"); + additionalFiles.ShouldContain(path); + } + + evaluation.Items("PackageReference").ShouldContain(item => item.Identity == "Microsoft.CodeAnalysis.PublicApiAnalyzers"); + } + + [Theory] + [MemberData(nameof(SourceProjects))] + public async Task Banned_symbols_are_wired_into_every_src_project(string projectName) + { + var evaluation = await MsBuild.EvaluateAsync(ProjectCatalog.Get(projectName)); + + evaluation.Items("AdditionalFiles") + .Select(item => Path.GetFullPath(item.FullPath)) + .ShouldContain(Repository.PathOf(BannedSymbolsFile)); + evaluation.Items("PackageReference").ShouldContain(item => item.Identity == "Microsoft.CodeAnalysis.BannedApiAnalyzers"); + } + + [Fact] + public void Banned_symbols_include_the_agreed_apis() + { + var bannedIds = Repository.ReadLines(BannedSymbolsFile) + .Select(line => line.Split(';', 2)[0].Trim()) + .ToHashSet(StringComparer.Ordinal); + + RequiredBannedSymbols.Where(symbol => !bannedIds.Contains(symbol)).ShouldBeEmpty(); + } +} diff --git a/tests/WalterEgo.Architecture.Tests/BuildSettingsTests.cs b/tests/WalterEgo.Architecture.Tests/BuildSettingsTests.cs new file mode 100644 index 0000000..6109829 --- /dev/null +++ b/tests/WalterEgo.Architecture.Tests/BuildSettingsTests.cs @@ -0,0 +1,81 @@ +using WalterEgo.Architecture.Tests.Support; + +namespace WalterEgo.Architecture.Tests; + +public sealed class BuildSettingsTests +{ + public static TheoryData AllProjects => ProjectCatalog.AllNames(); + + public static TheoryData SourceProjects => ProjectCatalog.SourceNames(); + + public static TheoryData NonSourceProjects => ProjectCatalog.NonSourceNames(); + + public static TheoryData AotCompatibleProjects => ProjectCatalog.AotCompatibleNames(); + + [Theory] + [MemberData(nameof(AllProjects))] + public async Task Every_project_inherits_the_common_build_settings(string projectName) + { + var evaluation = await MsBuild.EvaluateAsync(ProjectCatalog.Get(projectName)); + + evaluation.Property("TargetFramework").ShouldBe("net10.0"); + evaluation.Property("Nullable").ShouldBe("enable"); + evaluation.Property("TreatWarningsAsErrors").ShouldBe("true"); + evaluation.Property("AnalysisLevel").ShouldBe("latest-Recommended"); + evaluation.Property("EnforceCodeStyleInBuild").ShouldBe("true"); + evaluation.Property("RestorePackagesWithLockFile").ShouldBe("true"); + } + + [Theory] + [MemberData(nameof(SourceProjects))] + public async Task Src_projects_are_packable_and_documented(string projectName) + { + var evaluation = await MsBuild.EvaluateAsync(ProjectCatalog.Get(projectName)); + + evaluation.Property("IsPackable").ShouldBe("true"); + evaluation.Property("GenerateDocumentationFile").ShouldBe("true"); + + // The SDK turns package validation off for tool packages: they expose no API to keep compatible. + var expectedValidation = evaluation.Property("PackAsTool") == "true" ? "false" : "true"; + evaluation.Property("EnablePackageValidation").ShouldBe(expectedValidation); + } + + [Theory] + [MemberData(nameof(AotCompatibleProjects))] + public async Task Aot_compatible_projects_are_flagged(string projectName) + { + var evaluation = await MsBuild.EvaluateAsync(ProjectCatalog.Get(projectName)); + + evaluation.Property("IsAotCompatible").ShouldBe("true"); + } + + [Theory] + [MemberData(nameof(NonSourceProjects))] + public async Task Only_src_projects_are_packable(string projectName) + { + var evaluation = await MsBuild.EvaluateAsync(ProjectCatalog.Get(projectName)); + + evaluation.Property("IsPackable").ShouldNotBe("true"); + } + + [Fact] + public async Task Cli_is_packed_as_the_walterego_tool() + { + var evaluation = await MsBuild.EvaluateAsync(ProjectCatalog.Get("WalterEgo.Cli")); + + evaluation.Property("PackAsTool").ShouldBe("true"); + evaluation.Property("ToolCommandName").ShouldBe("walterego"); + } + + [Theory] + [MemberData(nameof(AllProjects))] + public async Task Ci_restores_in_locked_mode(string projectName) + { + var project = ProjectCatalog.Get(projectName); + var evaluation = await MsBuild.EvaluateAsync(project); + + evaluation.Property("RestoreLockedMode").ShouldBe("true"); + File.Exists(Repository.PathOf($"{project.RelativeDirectory}/packages.lock.json")) + .ShouldBeTrue($"{project.Name} has no packages.lock.json"); + } +} diff --git a/tests/WalterEgo.Architecture.Tests/ContractPathsTests.cs b/tests/WalterEgo.Architecture.Tests/ContractPathsTests.cs new file mode 100644 index 0000000..dc4b7fd --- /dev/null +++ b/tests/WalterEgo.Architecture.Tests/ContractPathsTests.cs @@ -0,0 +1,15 @@ +using WalterEgo.Architecture.Tests.Support; + +namespace WalterEgo.Architecture.Tests; + +public sealed class ContractPathsTests +{ + [Fact] + public void Contract_paths_cover_public_api_and_schemas() + { + var paths = Repository.ReadLines("eng/contract-paths.txt").Select(line => line.Trim()).ToList(); + + paths.ShouldContain("src/**/PublicAPI.*.txt"); + paths.ShouldContain("schemas/**"); + } +} diff --git a/tests/WalterEgo.Architecture.Tests/DependencyAllowlistTests.cs b/tests/WalterEgo.Architecture.Tests/DependencyAllowlistTests.cs new file mode 100644 index 0000000..a3762cf --- /dev/null +++ b/tests/WalterEgo.Architecture.Tests/DependencyAllowlistTests.cs @@ -0,0 +1,93 @@ +using System.Text.Json; +using WalterEgo.Architecture.Tests.Support; + +namespace WalterEgo.Architecture.Tests; + +public sealed class DependencyAllowlistTests +{ + private const string AllowlistFile = "eng/dependency-allowlist.json"; + + public static TheoryData SourceProjects => ProjectCatalog.SourceNames(); + + [Theory] + [MemberData(nameof(SourceProjects))] + public async Task Src_projects_only_depend_on_allowed_packages(string projectName) + { + var project = ProjectCatalog.Get(projectName); + var allowlist = DependencyAllowlist.Load(); + var allowed = allowlist.AllowedFor(projectName); + + var lockedDependencies = ReadLockFile(project); + var unexpectedPackages = lockedDependencies.Where(name => !allowed.Contains(name)).ToList(); + unexpectedPackages.ShouldBeEmpty($"{projectName} depends on packages or projects outside {AllowlistFile}"); + + var evaluation = await MsBuild.EvaluateAsync(project); + var unexpectedFrameworks = evaluation.Items("FrameworkReference") + .Select(item => item.Identity) + .Where(name => !allowed.Contains(name)) + .ToList(); + unexpectedFrameworks.ShouldBeEmpty($"{projectName} has framework references outside {AllowlistFile}"); + } + + [Fact] + public void Allowlist_covers_exactly_the_src_projects() + { + DependencyAllowlist.Load().ProjectNames + .Order(StringComparer.Ordinal) + .ShouldBe([.. ProjectCatalog.All.Where(project => project.IsSource).Select(project => project.Name).Order(StringComparer.Ordinal)]); + } + + private static List ReadLockFile(ProjectInfo project) + { + using var document = JsonDocument.Parse(Repository.ReadText($"{project.RelativeDirectory}/packages.lock.json")); + return [.. document.RootElement.GetProperty("dependencies") + .EnumerateObject() + .SelectMany(framework => framework.Value.EnumerateObject()) + .Select(dependency => dependency.Name) + .Distinct(StringComparer.OrdinalIgnoreCase)]; + } + + private sealed class DependencyAllowlist + { + private readonly HashSet _common; + private readonly Dictionary> _perProject; + + private DependencyAllowlist(HashSet common, Dictionary> perProject) + { + _common = common; + _perProject = perProject; + } + + public IEnumerable ProjectNames => _perProject.Keys; + + public static DependencyAllowlist Load() + { + using var document = JsonDocument.Parse(Repository.ReadText(AllowlistFile)); + var root = document.RootElement; + + HashSet common = new(StringComparer.OrdinalIgnoreCase); + common.UnionWith(Strings(root.GetProperty("buildOnly"))); + common.UnionWith(Strings(root.GetProperty("baseFrameworks"))); + + var perProject = root.GetProperty("projects") + .EnumerateObject() + .ToDictionary( + project => project.Name, + project => new HashSet( + [.. Strings(project.Value.GetProperty("packages")), + .. Strings(project.Value.GetProperty("projects")), + .. Strings(project.Value.GetProperty("frameworks"))], + StringComparer.OrdinalIgnoreCase)); + + return new DependencyAllowlist(common, perProject); + } + + public HashSet AllowedFor(string projectName) => + _perProject.TryGetValue(projectName, out var specific) + ? new HashSet([.. _common, .. specific], StringComparer.OrdinalIgnoreCase) + : throw new InvalidOperationException($"{projectName} is missing from {AllowlistFile}."); + + private static IEnumerable Strings(JsonElement array) => + array.EnumerateArray().Select(element => element.GetString() ?? string.Empty); + } +} diff --git a/tests/WalterEgo.Architecture.Tests/InternalReferenceTests.cs b/tests/WalterEgo.Architecture.Tests/InternalReferenceTests.cs new file mode 100644 index 0000000..ea78569 --- /dev/null +++ b/tests/WalterEgo.Architecture.Tests/InternalReferenceTests.cs @@ -0,0 +1,58 @@ +using WalterEgo.Architecture.Tests.Support; + +namespace WalterEgo.Architecture.Tests; + +public sealed class InternalReferenceTests +{ + [Fact] + public async Task Tracked_files_do_not_reference_internal_material() + { + var cancellationToken = TestContext.Current.CancellationToken; + var scanner = InternalReferenceScanner.FromRepository(); + List findings = []; + + foreach (var file in await Git.VersionedFilesAsync(cancellationToken)) + { + var path = Repository.PathOf(file); + if (!File.Exists(path) || await IsBinaryAsync(path, cancellationToken)) + { + continue; + } + + findings.AddRange(scanner.Scan(file, await File.ReadAllTextAsync(path, cancellationToken))); + } + + findings.ShouldBeEmpty(string.Join(Environment.NewLine, findings.Select(finding => $"{finding.Path}:{finding.Line}: {finding.Match}"))); + } + + [Fact] + public void Scanner_reports_the_file_and_line_of_an_internal_reference() + { + var scanner = new InternalReferenceScanner(RepositoryPatterns(), []); + + var findings = scanner.Scan("src/Example.cs", "// first line\n// implements spec 007\n").ToList(); + + findings.ShouldHaveSingleItem().ShouldBe(new InternalReferenceFinding("src/Example.cs", 2, "spec 007")); + } + + [Fact] + public void Scanner_accepts_allowlisted_occurrences() + { + var allowlist = InternalReferenceScanner.ParseAllowlist(["src/Example.cs | spec 007 | example of an accepted occurrence"]); + var scanner = new InternalReferenceScanner(RepositoryPatterns(), allowlist); + + scanner.Scan("src/Example.cs", "// implements spec 007\n").ShouldBeEmpty(); + scanner.Scan("src/Other.cs", "// implements spec 007\n").ShouldNotBeEmpty(); + } + + private static IReadOnlyList RepositoryPatterns() => + InternalReferenceScanner.ParsePatterns(Repository.ReadLines(InternalReferenceScanner.PatternsFile)); + + private static async Task IsBinaryAsync(string path, CancellationToken cancellationToken) + { + var buffer = new byte[8000]; + await using var stream = File.OpenRead(path); + var read = await stream.ReadAsync(buffer, cancellationToken); + return Array.IndexOf(buffer, (byte)0, 0, read) >= 0; + } +} diff --git a/tests/WalterEgo.Architecture.Tests/NuGetConfigTests.cs b/tests/WalterEgo.Architecture.Tests/NuGetConfigTests.cs new file mode 100644 index 0000000..f780e7d --- /dev/null +++ b/tests/WalterEgo.Architecture.Tests/NuGetConfigTests.cs @@ -0,0 +1,25 @@ +using System.Xml.Linq; +using WalterEgo.Architecture.Tests.Support; + +namespace WalterEgo.Architecture.Tests; + +public sealed class NuGetConfigTests +{ + private const string NuGetOrg = "https://api.nuget.org/v3/index.json"; + + [Fact] + public void Only_nuget_org_is_configured_with_source_mapping() + { + var configuration = XDocument.Load(Repository.PathOf("nuget.config")).Root.ShouldNotBeNull(); + + var sources = configuration.Element("packageSources").ShouldNotBeNull(); + sources.Elements().First().Name.LocalName.ShouldBe("clear"); + var source = sources.Elements("add").ShouldHaveSingleItem(); + ((string?)source.Attribute("value")).ShouldBe(NuGetOrg); + + var mapping = configuration.Element("packageSourceMapping").ShouldNotBeNull() + .Elements("packageSource").ShouldHaveSingleItem(); + ((string?)mapping.Attribute("key")).ShouldBe((string?)source.Attribute("key")); + mapping.Elements("package").Select(package => (string?)package.Attribute("pattern")).ShouldBe(["*"]); + } +} diff --git a/tests/WalterEgo.Architecture.Tests/RepositoryFilesTests.cs b/tests/WalterEgo.Architecture.Tests/RepositoryFilesTests.cs new file mode 100644 index 0000000..13c4f0c --- /dev/null +++ b/tests/WalterEgo.Architecture.Tests/RepositoryFilesTests.cs @@ -0,0 +1,34 @@ +using WalterEgo.Architecture.Tests.Support; + +namespace WalterEgo.Architecture.Tests; + +public sealed class RepositoryFilesTests +{ + [Fact] + public void Public_files_exist() + { + var license = Repository.ReadText("LICENSE"); + license.ShouldContain("MIT License"); + license.ShouldContain("Copyright (c) 2026 ScriptRunnerKit contributors"); + + var security = Repository.ReadText("SECURITY.md"); + security.ShouldContain("Report a vulnerability"); + security.ShouldContain("## Scope"); + + Repository.ReadText("CONTRIBUTING.md").ShouldNotBeNullOrWhiteSpace(); + + var changelog = Repository.ReadText("CHANGELOG.md"); + changelog.ShouldContain("Keep a Changelog"); + changelog.ShouldContain("## [Unreleased]"); + + Repository.ReadText("README.md").ShouldNotBeNullOrWhiteSpace(); + Repository.ReadText("README.pt-br.md").ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] + public void Readmes_link_to_each_other() + { + Repository.ReadText("README.md").ShouldContain("(README.pt-br.md)"); + Repository.ReadText("README.pt-br.md").ShouldContain("(README.md)"); + } +} diff --git a/tests/WalterEgo.Architecture.Tests/RepositoryHygieneTests.cs b/tests/WalterEgo.Architecture.Tests/RepositoryHygieneTests.cs new file mode 100644 index 0000000..657cfcc --- /dev/null +++ b/tests/WalterEgo.Architecture.Tests/RepositoryHygieneTests.cs @@ -0,0 +1,18 @@ +using WalterEgo.Architecture.Tests.Support; + +namespace WalterEgo.Architecture.Tests; + +public sealed class RepositoryHygieneTests +{ + private const string LocalOnlyFolder = "docs"; + + [Fact] + public async Task Docs_folder_is_ignored_and_untracked() + { + var cancellationToken = TestContext.Current.CancellationToken; + + Repository.ReadLines(".gitignore").Select(line => line.Trim()).ShouldContain($"/{LocalOnlyFolder}/"); + (await Git.TrackedFilesAsync(LocalOnlyFolder, cancellationToken)).ShouldBeEmpty(); + (await Git.IsIgnoredAsync($"{LocalOnlyFolder}/any-file.md", cancellationToken)).ShouldBeTrue(); + } +} diff --git a/tests/WalterEgo.Architecture.Tests/SolutionInventoryTests.cs b/tests/WalterEgo.Architecture.Tests/SolutionInventoryTests.cs new file mode 100644 index 0000000..aa1fe35 --- /dev/null +++ b/tests/WalterEgo.Architecture.Tests/SolutionInventoryTests.cs @@ -0,0 +1,21 @@ +using System.Xml.Linq; +using WalterEgo.Architecture.Tests.Support; + +namespace WalterEgo.Architecture.Tests; + +public sealed class SolutionInventoryTests +{ + [Fact] + public void Solution_contains_exactly_the_expected_projects() + { + var solution = XDocument.Load(Repository.PathOf("WalterEgo.slnx")); + + var projectPaths = solution.Descendants("Project") + .Select(project => ((string?)project.Attribute("Path") ?? string.Empty).Replace('\\', '/')) + .Order(StringComparer.Ordinal) + .ToList(); + + projectPaths.ShouldBe([.. ProjectCatalog.All.Select(project => project.RelativePath).Order(StringComparer.Ordinal)]); + ProjectCatalog.All.ShouldAllBe(project => File.Exists(Repository.PathOf(project.RelativePath))); + } +} diff --git a/tests/WalterEgo.Architecture.Tests/Support/Git.cs b/tests/WalterEgo.Architecture.Tests/Support/Git.cs new file mode 100644 index 0000000..2359ddb --- /dev/null +++ b/tests/WalterEgo.Architecture.Tests/Support/Git.cs @@ -0,0 +1,39 @@ +namespace WalterEgo.Architecture.Tests.Support; + +internal static class Git +{ + /// Tracked files plus untracked files that are not ignored: everything that would be versioned. + public static async Task> VersionedFilesAsync(CancellationToken cancellationToken) + { + var result = await RunAsync(["ls-files", "--cached", "--others", "--exclude-standard", "-z"], cancellationToken); + return result.StandardOutput.Split('\0', StringSplitOptions.RemoveEmptyEntries); + } + + public static async Task> TrackedFilesAsync(string pathspec, CancellationToken cancellationToken) + { + var result = await RunAsync(["ls-files", "-z", "--", pathspec], cancellationToken); + return result.StandardOutput.Split('\0', StringSplitOptions.RemoveEmptyEntries); + } + + public static async Task IsIgnoredAsync(string path, CancellationToken cancellationToken) + { + var result = await ProcessRunner.RunAsync("git", ["check-ignore", "-q", "--", path], cancellationToken); + return result.ExitCode switch + { + 0 => true, + 1 => false, + _ => throw new InvalidOperationException($"git check-ignore failed: {result.StandardError}"), + }; + } + + private static async Task RunAsync(IEnumerable arguments, CancellationToken cancellationToken) + { + var result = await ProcessRunner.RunAsync("git", arguments, cancellationToken); + if (result.ExitCode != 0) + { + throw new InvalidOperationException($"git {string.Join(' ', arguments)} failed: {result.StandardError}"); + } + + return result; + } +} diff --git a/tests/WalterEgo.Architecture.Tests/Support/InternalReferenceScanner.cs b/tests/WalterEgo.Architecture.Tests/Support/InternalReferenceScanner.cs new file mode 100644 index 0000000..2239356 --- /dev/null +++ b/tests/WalterEgo.Architecture.Tests/Support/InternalReferenceScanner.cs @@ -0,0 +1,59 @@ +using System.Text.RegularExpressions; + +namespace WalterEgo.Architecture.Tests.Support; + +internal sealed record InternalReferenceFinding(string Path, int Line, string Match); + +internal sealed record AllowlistEntry(string Path, string Excerpt); + +internal sealed class InternalReferenceScanner(IReadOnlyList patterns, IReadOnlyList allowlist) +{ + public const string PatternsFile = "eng/internal-references.patterns"; + public const string AllowlistFile = "eng/internal-references.allowlist"; + + private const string WholeFile = "*"; + + public static InternalReferenceScanner FromRepository() => + new(ParsePatterns(Repository.ReadLines(PatternsFile)), ParseAllowlist(Repository.ReadLines(AllowlistFile))); + + public static IReadOnlyList ParsePatterns(IEnumerable lines) => + [.. MeaningfulLines(lines).Select(line => new Regex(line, RegexOptions.CultureInvariant))]; + + public static IReadOnlyList ParseAllowlist(IEnumerable lines) => + [.. MeaningfulLines(lines).Select(ParseAllowlistEntry)]; + + public IEnumerable Scan(string path, string content) + { + var lines = content.Split('\n'); + for (var index = 0; index < lines.Length; index++) + { + var line = lines[index]; + foreach (var pattern in patterns) + { + var match = pattern.Match(line); + if (match.Success && !IsAllowed(path, line)) + { + yield return new InternalReferenceFinding(path, index + 1, match.Value); + } + } + } + } + + private bool IsAllowed(string path, string line) => + allowlist.Any(entry => entry.Path == path + && (entry.Excerpt == WholeFile || line.Contains(entry.Excerpt, StringComparison.Ordinal))); + + private static IEnumerable MeaningfulLines(IEnumerable lines) => + lines.Select(line => line.Trim()).Where(line => line.Length > 0 && !line.StartsWith('#')); + + private static AllowlistEntry ParseAllowlistEntry(string line) + { + var parts = line.Split('|', 3, StringSplitOptions.TrimEntries); + if (parts.Length != 3 || parts.Any(part => part.Length == 0)) + { + throw new FormatException($"Allowlist entries must be 'path | excerpt | reason': {line}"); + } + + return new AllowlistEntry(parts[0], parts[1]); + } +} diff --git a/tests/WalterEgo.Architecture.Tests/Support/MsBuild.cs b/tests/WalterEgo.Architecture.Tests/Support/MsBuild.cs new file mode 100644 index 0000000..3d587e8 --- /dev/null +++ b/tests/WalterEgo.Architecture.Tests/Support/MsBuild.cs @@ -0,0 +1,84 @@ +using System.Collections.Concurrent; +using System.Text.Json; + +namespace WalterEgo.Architecture.Tests.Support; + +internal sealed record EvaluatedItem(string Identity, string FullPath); + +internal sealed class ProjectEvaluation( + IReadOnlyDictionary properties, + IReadOnlyDictionary> items) +{ + public string Property(string name) => properties.GetValueOrDefault(name, string.Empty); + + public IReadOnlyList Items(string itemType) => items.GetValueOrDefault(itemType, []); +} + +/// +/// Reads evaluated MSBuild properties and items, as they would be on the CI (GITHUB_ACTIONS=true). +/// Each project is evaluated once per test run. +/// +internal static class MsBuild +{ + private static readonly string[] PropertyNames = + [ + "TargetFramework", + "Nullable", + "TreatWarningsAsErrors", + "AnalysisLevel", + "EnforceCodeStyleInBuild", + "GenerateDocumentationFile", + "RestorePackagesWithLockFile", + "RestoreLockedMode", + "IsPackable", + "IsAotCompatible", + "EnablePackageValidation", + "PackAsTool", + "ToolCommandName", + ]; + + private static readonly string[] ItemTypes = ["AdditionalFiles", "PackageReference", "FrameworkReference"]; + + private static readonly ConcurrentDictionary>> Cache = new(); + + public static Task EvaluateAsync(ProjectInfo project) => + Cache.GetOrAdd(project.RelativePath, path => new Lazy>(() => RunEvaluationAsync(path))).Value; + + private static async Task RunEvaluationAsync(string relativePath) + { + string[] arguments = + [ + "msbuild", + Repository.PathOf(relativePath), + "-nologo", + "-p:GITHUB_ACTIONS=true", + .. PropertyNames.Select(name => $"-getProperty:{name}"), + .. ItemTypes.Select(type => $"-getItem:{type}"), + ]; + + var result = await ProcessRunner.RunAsync("dotnet", arguments, CancellationToken.None); + if (result.ExitCode != 0) + { + throw new InvalidOperationException($"Evaluation of {relativePath} failed:{Environment.NewLine}{result.StandardOutput}{result.StandardError}"); + } + + using var document = JsonDocument.Parse(result.StandardOutput); + var root = document.RootElement; + + var properties = root.GetProperty("Properties") + .EnumerateObject() + .ToDictionary(property => property.Name, property => property.Value.GetString() ?? string.Empty); + + var items = root.GetProperty("Items") + .EnumerateObject() + .ToDictionary( + itemType => itemType.Name, + itemType => (IReadOnlyList)[.. itemType.Value.EnumerateArray().Select(ToItem)]); + + return new ProjectEvaluation(properties, items); + } + + private static EvaluatedItem ToItem(JsonElement item) => + new(item.GetProperty("Identity").GetString() ?? string.Empty, + item.TryGetProperty("FullPath", out var fullPath) ? fullPath.GetString() ?? string.Empty : string.Empty); +} diff --git a/tests/WalterEgo.Architecture.Tests/Support/ProcessRunner.cs b/tests/WalterEgo.Architecture.Tests/Support/ProcessRunner.cs new file mode 100644 index 0000000..a0da55e --- /dev/null +++ b/tests/WalterEgo.Architecture.Tests/Support/ProcessRunner.cs @@ -0,0 +1,36 @@ +using System.Diagnostics; + +namespace WalterEgo.Architecture.Tests.Support; + +internal sealed record ProcessResult(int ExitCode, string StandardOutput, string StandardError); + +internal static class ProcessRunner +{ + public static async Task RunAsync( + string fileName, + IEnumerable arguments, + CancellationToken cancellationToken) + { + var startInfo = new ProcessStartInfo(fileName) + { + WorkingDirectory = Repository.Root, + RedirectStandardOutput = true, + RedirectStandardError = true, + UseShellExecute = false, + }; + + foreach (var argument in arguments) + { + startInfo.ArgumentList.Add(argument); + } + + using var process = Process.Start(startInfo) + ?? throw new InvalidOperationException($"Could not start {fileName}."); + + var output = process.StandardOutput.ReadToEndAsync(cancellationToken); + var error = process.StandardError.ReadToEndAsync(cancellationToken); + await process.WaitForExitAsync(cancellationToken); + + return new ProcessResult(process.ExitCode, await output, await error); + } +} diff --git a/tests/WalterEgo.Architecture.Tests/Support/ProjectCatalog.cs b/tests/WalterEgo.Architecture.Tests/Support/ProjectCatalog.cs new file mode 100644 index 0000000..0d959ff --- /dev/null +++ b/tests/WalterEgo.Architecture.Tests/Support/ProjectCatalog.cs @@ -0,0 +1,52 @@ +namespace WalterEgo.Architecture.Tests.Support; + +internal sealed record ProjectInfo(string Name, string Folder) +{ + public string RelativePath => $"{Folder}/{Name}/{Name}.csproj"; + + public string RelativeDirectory => $"{Folder}/{Name}"; + + public bool IsSource => Folder == "src"; +} + +internal static class ProjectCatalog +{ + public static IReadOnlyList All { get; } = + [ + new("WalterEgo.Core", "src"), + new("WalterEgo.AspNetCore", "src"), + new("WalterEgo.AspNetCore.Identity", "src"), + new("WalterEgo.EntityFrameworkCore", "src"), + new("WalterEgo.Alerting.Webhook", "src"), + new("WalterEgo.Generators", "src"), + new("WalterEgo.Cli", "src"), + new("WalterEgo.Core.Tests", "tests"), + new("WalterEgo.AspNetCore.Tests", "tests"), + new("WalterEgo.AspNetCore.Identity.Tests", "tests"), + new("WalterEgo.EntityFrameworkCore.Tests", "tests"), + new("WalterEgo.Alerting.Webhook.Tests", "tests"), + new("WalterEgo.Generators.Tests", "tests"), + new("WalterEgo.Cli.Tests", "tests"), + new("WalterEgo.Architecture.Tests", "tests"), + new("WalterEgo.Benchmarks", "tests"), + new("WalterEgo.Samples.MinimalApi", "samples"), + ]; + + public static IReadOnlySet AotCompatible { get; } = new HashSet( + [ + "WalterEgo.Core", + "WalterEgo.AspNetCore", + "WalterEgo.AspNetCore.Identity", + "WalterEgo.Alerting.Webhook", + ]); + + public static ProjectInfo Get(string name) => All.Single(project => project.Name == name); + + public static TheoryData AllNames() => [.. All.Select(project => project.Name)]; + + public static TheoryData SourceNames() => [.. All.Where(project => project.IsSource).Select(project => project.Name)]; + + public static TheoryData NonSourceNames() => [.. All.Where(project => !project.IsSource).Select(project => project.Name)]; + + public static TheoryData AotCompatibleNames() => [.. AotCompatible]; +} diff --git a/tests/WalterEgo.Architecture.Tests/Support/Repository.cs b/tests/WalterEgo.Architecture.Tests/Support/Repository.cs new file mode 100644 index 0000000..4019535 --- /dev/null +++ b/tests/WalterEgo.Architecture.Tests/Support/Repository.cs @@ -0,0 +1,27 @@ +namespace WalterEgo.Architecture.Tests.Support; + +internal static class Repository +{ + private const string SolutionFileName = "WalterEgo.slnx"; + + public static string Root { get; } = FindRoot(); + + public static string PathOf(string relativePath) => Path.GetFullPath(Path.Combine(Root, relativePath)); + + public static string ReadText(string relativePath) => File.ReadAllText(PathOf(relativePath)); + + public static string[] ReadLines(string relativePath) => File.ReadAllLines(PathOf(relativePath)); + + private static string FindRoot() + { + for (var directory = new DirectoryInfo(AppContext.BaseDirectory); directory is not null; directory = directory.Parent) + { + if (File.Exists(Path.Combine(directory.FullName, SolutionFileName))) + { + return directory.FullName; + } + } + + throw new InvalidOperationException($"{SolutionFileName} was not found above {AppContext.BaseDirectory}."); + } +} diff --git a/tests/WalterEgo.Architecture.Tests/Support/WorkflowFile.cs b/tests/WalterEgo.Architecture.Tests/Support/WorkflowFile.cs new file mode 100644 index 0000000..f77d1ac --- /dev/null +++ b/tests/WalterEgo.Architecture.Tests/Support/WorkflowFile.cs @@ -0,0 +1,80 @@ +using System.Text.RegularExpressions; + +namespace WalterEgo.Architecture.Tests.Support; + +/// +/// Line-based reader for the repository's own GitHub Actions workflows (two-space indentation, jobs at level one). +/// +internal sealed partial class WorkflowFile(string relativePath, string[] lines) +{ + public string RelativePath { get; } = relativePath; + + public string Text { get; } = string.Join('\n', lines); + + public static IReadOnlyList All() => + [.. Directory.EnumerateFiles(Repository.PathOf(".github/workflows")) + .Where(path => path.EndsWith(".yml", StringComparison.Ordinal) || path.EndsWith(".yaml", StringComparison.Ordinal)) + .Order(StringComparer.Ordinal) + .Select(Load)]; + + public static WorkflowFile Load(string path) => + new(Path.GetRelativePath(Repository.Root, path).Replace('\\', '/'), File.ReadAllLines(path)); + + public IEnumerable ActionReferences() => + lines.Select(line => UsesPattern().Match(line)) + .Where(match => match.Success) + .Select(match => match.Groups["ref"].Value); + + public IReadOnlyList TopLevelBlock(string key) + { + var start = Array.FindIndex(lines, line => line.StartsWith($"{key}:", StringComparison.Ordinal)); + if (start < 0) + { + return []; + } + + var inline = lines[start][(key.Length + 1)..].Trim(); + return inline.Length > 0 ? [inline] : [.. lines.Skip(start + 1).TakeWhile(IsIndentedOrBlank)]; + } + + public IReadOnlyDictionary> Jobs() + { + var jobs = new Dictionary>(StringComparer.Ordinal); + string? current = null; + List body = []; + + foreach (var line in TopLevelBlock("jobs")) + { + var header = JobHeaderPattern().Match(line); + if (header.Success) + { + if (current is not null) + { + jobs[current] = body; + } + + current = header.Groups["name"].Value; + body = []; + } + else + { + body.Add(line); + } + } + + if (current is not null) + { + jobs[current] = body; + } + + return jobs; + } + + private static bool IsIndentedOrBlank(string line) => line.Length == 0 || char.IsWhiteSpace(line[0]) || line.StartsWith('#'); + + [GeneratedRegex("""^\s*(?:-\s+)?uses:\s*['"]?(?[^\s'"#]+)""")] + private static partial Regex UsesPattern(); + + [GeneratedRegex(@"^ (?[A-Za-z0-9_-]+):\s*$")] + private static partial Regex JobHeaderPattern(); +} diff --git a/tests/WalterEgo.Architecture.Tests/WalterEgo.Architecture.Tests.csproj b/tests/WalterEgo.Architecture.Tests/WalterEgo.Architecture.Tests.csproj new file mode 100644 index 0000000..35e3d84 --- /dev/null +++ b/tests/WalterEgo.Architecture.Tests/WalterEgo.Architecture.Tests.csproj @@ -0,0 +1,2 @@ + + diff --git a/tests/WalterEgo.Architecture.Tests/WorkflowTests.cs b/tests/WalterEgo.Architecture.Tests/WorkflowTests.cs new file mode 100644 index 0000000..20c6a19 --- /dev/null +++ b/tests/WalterEgo.Architecture.Tests/WorkflowTests.cs @@ -0,0 +1,114 @@ +using System.Text.RegularExpressions; +using WalterEgo.Architecture.Tests.Support; + +namespace WalterEgo.Architecture.Tests; + +public sealed partial class WorkflowTests +{ + private const int MaxJobMinutes = 15; + + [Fact] + public void Every_action_is_pinned_to_a_commit_sha() + { + var workflows = WorkflowFile.All(); + workflows.ShouldNotBeEmpty(); + + var unpinned = workflows + .SelectMany(workflow => workflow.ActionReferences().Select(reference => (workflow.RelativePath, reference))) + .Where(usage => !usage.reference.StartsWith("./", StringComparison.Ordinal) && !PinnedAction().IsMatch(usage.reference)) + .Select(usage => $"{usage.RelativePath}: {usage.reference}") + .ToList(); + + unpinned.ShouldBeEmpty(); + } + + [Fact] + public void Every_job_has_a_timeout() + { + foreach (var workflow in WorkflowFile.All()) + { + var jobs = workflow.Jobs(); + jobs.ShouldNotBeEmpty($"{workflow.RelativePath} has no jobs"); + + foreach (var (name, body) in jobs) + { + var timeout = body.Select(line => JobTimeout().Match(line)).FirstOrDefault(match => match.Success); + timeout.ShouldNotBeNull($"{workflow.RelativePath}: job '{name}' has no timeout-minutes"); + int.Parse(timeout.Groups["minutes"].Value, System.Globalization.CultureInfo.InvariantCulture) + .ShouldBeInRange(1, MaxJobMinutes, $"{workflow.RelativePath}: job '{name}'"); + } + } + } + + [Fact] + public void Workflows_default_to_read_only_permissions() + { + foreach (var workflow in WorkflowFile.All()) + { + var permissions = workflow.TopLevelBlock("permissions"); + + permissions.ShouldContain(line => ContentsRead().IsMatch(line), $"{workflow.RelativePath} must declare contents: read at the top level"); + permissions.ShouldNotContain(line => line.Contains("write", StringComparison.Ordinal), $"{workflow.RelativePath} grants write permissions at the top level"); + } + } + + [Fact] + public void CodeQl_and_scorecard_are_configured() + { + var codeQl = WorkflowFile.Load(Repository.PathOf(".github/workflows/codeql.yml")).Text; + codeQl.ShouldContain("github/codeql-action/init@"); + codeQl.ShouldContain("csharp"); + codeQl.ShouldContain("language: actions"); + codeQl.ShouldContain("security-extended"); + codeQl.ShouldContain("pull_request:"); + codeQl.ShouldContain("push:"); + codeQl.ShouldContain("schedule:"); + + var scorecard = WorkflowFile.Load(Repository.PathOf(".github/workflows/scorecard.yml")).Text; + scorecard.ShouldContain("ossf/scorecard-action@"); + scorecard.ShouldContain("publish_results: true"); + scorecard.ShouldContain("push:"); + scorecard.ShouldContain("schedule:"); + } + + [Fact] + public void Contract_samples_check_reacts_to_labels() + { + var workflow = WorkflowFile.Load(Repository.PathOf(".github/workflows/contract-samples.yml")).Text; + + workflow.ShouldContain("pull_request:"); + workflow.ShouldContain("labeled"); + workflow.ShouldContain("unlabeled"); + workflow.ShouldContain("no-sample-impact"); + } + + [Fact] + public void Pull_request_checks_react_to_edits() + { + var workflow = WorkflowFile.Load(Repository.PathOf(".github/workflows/pull-request.yml")); + + workflow.Text.ShouldContain("edited"); + workflow.Jobs().Keys.ShouldBe(["pr-title", "internal-references"], ignoreOrder: true); + } + + [Fact] + public void Dependabot_covers_nuget_and_actions_weekly() + { + var dependabot = Repository.ReadText(".github/dependabot.yml"); + + dependabot.ShouldContain("package-ecosystem: nuget"); + dependabot.ShouldContain("package-ecosystem: github-actions"); + Regex.Count(dependabot, @"interval:\s*weekly").ShouldBe(2); + Regex.Count(dependabot, @"day:\s*monday").ShouldBe(2); + dependabot.ShouldContain("groups:"); + } + + [GeneratedRegex(@"^[A-Za-z0-9_.-]+/[A-Za-z0-9_./-]+@[0-9a-f]{40}$")] + private static partial Regex PinnedAction(); + + [GeneratedRegex(@"^\s{4}timeout-minutes:\s*(?\d+)\s*$")] + private static partial Regex JobTimeout(); + + [GeneratedRegex(@"^\s*contents:\s*read\s*$")] + private static partial Regex ContentsRead(); +} diff --git a/tests/WalterEgo.Architecture.Tests/packages.lock.json b/tests/WalterEgo.Architecture.Tests/packages.lock.json new file mode 100644 index 0000000..8fdfa6f --- /dev/null +++ b/tests/WalterEgo.Architecture.Tests/packages.lock.json @@ -0,0 +1,204 @@ +{ + "version": 2, + "dependencies": { + "net10.0": { + "Microsoft.Testing.Extensions.CodeCoverage": { + "type": "Direct", + "requested": "[18.12.0, )", + "resolved": "18.12.0", + "contentHash": "BST/sWYpKk9OXO7Yxktcg6FWORRsHU0EdCbMwZ7d3OqJsMKlrNHIZ30g0Ib4k5T5acJYXRBmg9mNrTU/N6cy1g==", + "dependencies": { + "Microsoft.DiaSymReader": "2.2.10", + "Microsoft.Extensions.DependencyModel": "10.0.10", + "Microsoft.Testing.Platform": "2.5.0", + "Mono.Cecil": "0.11.6" + } + }, + "MinVer": { + "type": "Direct", + "requested": "[8.0.0, )", + "resolved": "8.0.0", + "contentHash": "AJy/KVjXgUbgjf6HiI8wAk4DSSq0SCmvXQF8aU6IB+pnIQq+YJvofvMczug2hqO8yEvnQY557ryew66KPpyCsA==" + }, + "Shouldly": { + "type": "Direct", + "requested": "[4.3.0, )", + "resolved": "4.3.0", + "contentHash": "sDetrWXrl6YXZ4HeLsdBoNk3uIa7K+V4uvIJ+cqdRa5DrFxeTED7VkjoxCuU1kJWpUuBDZz2QXFzSxBtVXLwRQ==", + "dependencies": { + "DiffEngine": "11.3.0", + "EmptyFiles": "4.4.0" + } + }, + "xunit.v3": { + "type": "Direct", + "requested": "[4.0.2, )", + "resolved": "4.0.2", + "contentHash": "TdjM2OAx7w/0E88E6PgaigLoTbQaxbSR3HF/8p92plchTjf29jPHW27ylvEOz+Nx8CvPwWKGQlOR1fDv6/Qh5A==", + "dependencies": { + "xunit.v3.mtp-v2": "[4.0.2]" + } + }, + "DiffEngine": { + "type": "Transitive", + "resolved": "11.3.0", + "contentHash": "k0ZgZqd09jLZQjR8FyQbSQE86Q7QZnjEzq1LPHtj1R2AoWO8sjV5x+jlSisL7NZAbUOI4y+7Bog8gkr9WIRBGw==", + "dependencies": { + "EmptyFiles": "4.4.0", + "System.Management": "6.0.1" + } + }, + "EmptyFiles": { + "type": "Transitive", + "resolved": "4.4.0", + "contentHash": "gwJEfIGS7FhykvtZoscwXj/XwW+mJY6UbAZk+qtLKFUGWC95kfKXnj8VkxsZQnWBxJemM/q664rGLN5nf+OHZw==" + }, + "Microsoft.ApplicationInsights": { + "type": "Transitive", + "resolved": "2.23.0", + "contentHash": "nWArUZTdU7iqZLycLKWe0TDms48KKGE6pONH2terYNa8REXiqixrMOkf1sk5DHGMaUTqONU2YkS4SAXBhLStgw==" + }, + "Microsoft.Bcl.AsyncInterfaces": { + "type": "Transitive", + "resolved": "6.0.0", + "contentHash": "UcSjPsst+DfAdJGVDsu346FX0ci0ah+lw3WRtn18NUwEqRt70HaOQ7lI72vy3+1LxtqI3T5GWwV39rQSrCzAeg==" + }, + "Microsoft.DiaSymReader": { + "type": "Transitive", + "resolved": "2.2.10", + "contentHash": "zmGsm6b2y3STDa/Of7rdkkfTDV8VuGB8aCqIkLoJIQh5tL78K3zJ8OUyFKnfsaORXmGr9iOKwDkZfUjeXi+CwA==" + }, + "Microsoft.Extensions.DependencyModel": { + "type": "Transitive", + "resolved": "10.0.10", + "contentHash": "rfZA1RjR021RPqSmIPovfz2aOd79TGqJ9BengbjnzIISOVwjLmuSDnhCMmiY/1c6iYvGolQ1iNGzkav0u11XEA==" + }, + "Microsoft.Testing.Extensions.Telemetry": { + "type": "Transitive", + "resolved": "2.5.1", + "contentHash": "mu2iyoHovwl0q1mGeeRU0h8+LALXC7HqbxniLa1shTKYdJGl+KPoCEgjWIQ8MLzk1tlTGPOfg1JsxdH3RxhMCA==", + "dependencies": { + "Microsoft.ApplicationInsights": "2.23.0", + "Microsoft.Testing.Platform": "[2.5.1, 3.0.0)" + } + }, + "Microsoft.Testing.Extensions.TrxReport.Abstractions": { + "type": "Transitive", + "resolved": "2.5.1", + "contentHash": "DYTZAguaHz0wNJdHDTTGYOXtnlDoLoIbTMDKSApNNcytm55DJcnwpwELfQGLk5DB5QlgaEjNhnGo1Pu5QvL5VA==", + "dependencies": { + "Microsoft.Testing.Platform": "[2.5.1, 3.0.0)" + } + }, + "Microsoft.Testing.Platform": { + "type": "Transitive", + "resolved": "2.5.1", + "contentHash": "FAMaFFWnULW+hDHMb40Qzhcgz9cAU2/EtgRCBNX/DdQoKo0sPG2EiY+w7bQdl/BgHnf/DbpXLbf5Xy0o15M8NA==" + }, + "Microsoft.Testing.Platform.MSBuild": { + "type": "Transitive", + "resolved": "2.5.1", + "contentHash": "lYawcAwY+h76rQmpma2n0HaL8zkOFbbKapso0Eb+uOAUQn7333pIByLftEuiO67csAoZufHNMwi6PqhNemWQXA==", + "dependencies": { + "Microsoft.Testing.Platform": "[2.5.1, 3.0.0)" + } + }, + "Microsoft.Win32.Registry": { + "type": "Transitive", + "resolved": "5.0.0", + "contentHash": "dDoKi0PnDz31yAyETfRntsLArTlVAVzUzCIvvEDsDsucrl33Dl8pIJG06ePTJTI3tGpeyHS9Cq7Foc/s4EeKcg==" + }, + "Mono.Cecil": { + "type": "Transitive", + "resolved": "0.11.6", + "contentHash": "f33RkDtZO8VlGXCtmQIviOtxgnUdym9xx/b1p9h91CRGOsJFxCFOFK1FDbVt1OCf1aWwYejUFa2MOQyFWTFjbA==" + }, + "System.CodeDom": { + "type": "Transitive", + "resolved": "6.0.0", + "contentHash": "CPc6tWO1LAer3IzfZufDBRL+UZQcj5uS207NHALQzP84Vp/z6wF0Aa0YZImOQY8iStY0A2zI/e3ihKNPfUm8XA==" + }, + "System.Management": { + "type": "Transitive", + "resolved": "6.0.1", + "contentHash": "10J1D0h/lioojphfJ4Fuh5ZUThT/xOVHdV9roGBittKKNP2PMjrvibEdbVTGZcPra1399Ja3tqIJLyQrc5Wmhg==", + "dependencies": { + "System.CodeDom": "6.0.0" + } + }, + "System.Security.AccessControl": { + "type": "Transitive", + "resolved": "6.0.1", + "contentHash": "IQ4NXP/B3Ayzvw0rDQzVTYsCKyy0Jp9KI6aYcK7UnGVlR9+Awz++TIPCQtPYfLJfOpm8ajowMR09V7quD3sEHw==" + }, + "xunit.analyzers": { + "type": "Transitive", + "resolved": "2.2.0", + "contentHash": "dXMIIztipcAyL3a19gtUrih/RLrE33/4VJdICoinYqIXXo1KLtsMPsaQ9dO2pE8xajDguwE2kqVbBqE5/EoJ0Q==" + }, + "xunit.v3.assert": { + "type": "Transitive", + "resolved": "4.0.2", + "contentHash": "5PKRexYlvufWFdXenRcRGKqvaJBBZFJZpqUGlUs9p13eKEgVdOrLpkPknjzUvLY5kEUicK9871DIUDcCPA6AXA==" + }, + "xunit.v3.common": { + "type": "Transitive", + "resolved": "4.0.2", + "contentHash": "++CtT8daIf6qfieQev/8V88U3zViIDWou5cj+oWps1/Hf73UoaY/L0hKyi3v7Zlt3BmbU0pUc73zCB1GiB4nYA==", + "dependencies": { + "Microsoft.Bcl.AsyncInterfaces": "6.0.0" + } + }, + "xunit.v3.core.mtp-v2": { + "type": "Transitive", + "resolved": "4.0.2", + "contentHash": "XyPMcQRsnUQLhmBBRRgYWsuPc8TyiANzcXtqfzyWfDpPuyh3Q0K4oWozZYQKZRNGnqJ97ifD6qUDWhsEEe32uw==", + "dependencies": { + "Microsoft.Testing.Extensions.Telemetry": "2.5.1", + "Microsoft.Testing.Extensions.TrxReport.Abstractions": "2.5.1", + "Microsoft.Testing.Platform": "2.5.1", + "Microsoft.Testing.Platform.MSBuild": "2.5.1", + "xunit.v3.extensibility.core": "[4.0.2]", + "xunit.v3.runner.inproc.console": "[4.0.2]" + } + }, + "xunit.v3.extensibility.core": { + "type": "Transitive", + "resolved": "4.0.2", + "contentHash": "ARTt+pGyd86mdtiFBkKpyBQvRC3u0rr8oidBlII2GsAg7D6TfOsDFCsoQtFij83V5pE57m3whUIqT4xjiARXbQ==", + "dependencies": { + "xunit.v3.common": "[4.0.2]" + } + }, + "xunit.v3.mtp-v2": { + "type": "Transitive", + "resolved": "4.0.2", + "contentHash": "XLV32FhkuvheBStvX0DvjfPEtI+4SOVcIhnlTS+549r8VfVwsjpWdkJtQmQ7D23PA+Zoaqo+sTjBkRSkidC6Tw==", + "dependencies": { + "xunit.analyzers": "2.2.0", + "xunit.v3.assert": "[4.0.2]", + "xunit.v3.core.mtp-v2": "[4.0.2]" + } + }, + "xunit.v3.runner.common": { + "type": "Transitive", + "resolved": "4.0.2", + "contentHash": "YlYKVhTJVcwEgJ6rm59Pjf71lQqKwKxEHqVRxWUuwrwm/nxB/mNFP/lP4vlntDO3GclNnLT9BjYOpJH9gViGQg==", + "dependencies": { + "Microsoft.Win32.Registry": "[5.0.0]", + "System.Security.AccessControl": "[6.0.1]", + "xunit.v3.common": "[4.0.2]" + } + }, + "xunit.v3.runner.inproc.console": { + "type": "Transitive", + "resolved": "4.0.2", + "contentHash": "cg4XNpCN4Ry9nswutknpreN3ckSUBwtjMRmEQSNK/sIKPo6KN5tDGGGCaHDm5HGA4yFVVtTJX65tLCsZArUNfQ==", + "dependencies": { + "xunit.v3.extensibility.core": "[4.0.2]", + "xunit.v3.runner.common": "[4.0.2]" + } + } + } + } +} \ No newline at end of file From 73f0727a030ff37c000fb1abdeae9359e593c037 Mon Sep 17 00:00:00 2001 From: net0well Date: Wed, 21 Oct 2026 17:32:17 -0300 Subject: [PATCH 3/4] ci: add workflows, repository checks and dependabot configuration --- .github/dependabot.yml | 32 ++++++++ .github/workflows/ci.yml | 102 +++++++++++++++++++++++++ .github/workflows/codeql.yml | 58 ++++++++++++++ .github/workflows/contract-samples.yml | 31 ++++++++ .github/workflows/pull-request.yml | 46 +++++++++++ .github/workflows/scorecard.yml | 42 ++++++++++ eng/check-contract-samples.sh | 47 ++++++++++++ eng/check-internal-references.sh | 33 ++++++++ eng/check-packages.sh | 39 ++++++++++ eng/check-pr-title.sh | 14 ++++ eng/coverage-summary.sh | 32 ++++++++ 11 files changed, 476 insertions(+) create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/codeql.yml create mode 100644 .github/workflows/contract-samples.yml create mode 100644 .github/workflows/pull-request.yml create mode 100644 .github/workflows/scorecard.yml create mode 100644 eng/check-contract-samples.sh create mode 100644 eng/check-internal-references.sh create mode 100644 eng/check-packages.sh create mode 100644 eng/check-pr-title.sh create mode 100644 eng/coverage-summary.sh diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..f20f39d --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,32 @@ +# Minor and patch updates arrive grouped by family; majors arrive one by one. +version: 2 +updates: + - package-ecosystem: nuget + directory: / + schedule: + interval: weekly + day: monday + open-pull-requests-limit: 5 + groups: + analyzers-and-build: + patterns: ["Microsoft.CodeAnalysis.*", "MinVer"] + update-types: [minor, patch] + testing: + patterns: ["xunit*", "Shouldly", "Microsoft.Testing.*", "BenchmarkDotNet*"] + update-types: [minor, patch] + dotnet: + patterns: ["Microsoft.*", "System.*"] + update-types: [minor, patch] + other: + patterns: ["*"] + update-types: [minor, patch] + + - package-ecosystem: github-actions + directory: / + schedule: + interval: weekly + day: monday + groups: + actions: + patterns: ["*"] + update-types: [minor, patch] diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..fd9ef8b --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,102 @@ +name: CI + +on: + push: + branches: [main] + pull_request: + branches: [main] + +permissions: + contents: read + +concurrency: + group: ci-${{ github.ref }} + cancel-in-progress: true + +env: + DOTNET_NOLOGO: true + DOTNET_CLI_TELEMETRY_OPTOUT: true + +jobs: + build-test: + name: build-test (${{ matrix.os }}) + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, windows-latest] + runs-on: ${{ matrix.os }} + timeout-minutes: 15 + steps: + # Full history: MinVer computes the version from the tags. + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + fetch-depth: 0 + persist-credentials: false + + - uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0 + with: + global-json-file: global.json + + - name: Restore + run: dotnet restore + + - name: Build + run: dotnet build --no-restore --configuration Release + + - name: Test + if: runner.os == 'Linux' + run: dotnet test --no-build --configuration Release --coverage --coverage-output-format cobertura --results-directory artifacts/test-results + + # GitHub's Windows runners cannot run Linux containers. + - name: Test (without Docker) + if: runner.os == 'Windows' + run: dotnet test --no-build --configuration Release --filter-not-trait "Category=Docker" + + - name: Coverage summary + if: runner.os == 'Linux' + run: bash eng/coverage-summary.sh artifacts/test-results + + - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 + if: runner.os == 'Linux' + with: + name: coverage + path: artifacts/test-results/**/*.cobertura.xml + if-no-files-found: error + + quality: + name: quality + runs-on: ubuntu-latest + timeout-minutes: 15 + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + fetch-depth: 0 + persist-credentials: false + + - uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0 + with: + global-json-file: global.json + + - name: format + run: dotnet format --verify-no-changes + + pack: + name: pack + runs-on: ubuntu-latest + timeout-minutes: 15 + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + fetch-depth: 0 + persist-credentials: false + + - uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0 + with: + global-json-file: global.json + + - name: Pack + run: dotnet pack --configuration Release --output artifacts/packages + + # Builds of untagged commits are always prereleases. + - name: Check packages + run: bash eng/check-packages.sh artifacts/packages 7 '^[0-9]+\.[0-9]+\.[0-9]+-' diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 0000000..17b7f88 --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,58 @@ +name: CodeQL + +on: + push: + branches: [main] + pull_request: + branches: [main] + schedule: + - cron: '27 4 * * 1' + +permissions: + contents: read + +concurrency: + group: codeql-${{ github.ref }} + cancel-in-progress: true + +jobs: + analyze: + name: analyze (${{ matrix.language }}) + runs-on: ubuntu-latest + timeout-minutes: 15 + permissions: + actions: read + contents: read + security-events: write + strategy: + fail-fast: false + matrix: + include: + - language: csharp + build-mode: manual + - language: actions + build-mode: none + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + fetch-depth: 0 + persist-credentials: false + + - uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0 + if: matrix.language == 'csharp' + with: + global-json-file: global.json + + - uses: github/codeql-action/init@24c54180a607b1449ed407dd24f251e4e9147c8d # v4.38.3 + with: + languages: ${{ matrix.language }} + build-mode: ${{ matrix.build-mode }} + queries: security-extended + + - name: Build + if: matrix.build-mode == 'manual' + run: dotnet build --configuration Release + + - uses: github/codeql-action/analyze@24c54180a607b1449ed407dd24f251e4e9147c8d # v4.38.3 + with: + category: /language:${{ matrix.language }} diff --git a/.github/workflows/contract-samples.yml b/.github/workflows/contract-samples.yml new file mode 100644 index 0000000..f174e84 --- /dev/null +++ b/.github/workflows/contract-samples.yml @@ -0,0 +1,31 @@ +name: Contract and samples + +on: + pull_request: + branches: [main] + types: [opened, synchronize, reopened, labeled, unlabeled] + +permissions: + contents: read + +concurrency: + group: contract-samples-${{ github.event.pull_request.number }} + cancel-in-progress: true + +jobs: + contract-samples: + name: contract-samples + runs-on: ubuntu-latest + timeout-minutes: 5 + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + fetch-depth: 0 + persist-credentials: false + + - name: contract-samples + env: + BASE_SHA: ${{ github.event.pull_request.base.sha }} + HEAD_SHA: ${{ github.event.pull_request.head.sha }} + HAS_NO_SAMPLE_IMPACT_LABEL: ${{ contains(github.event.pull_request.labels.*.name, 'no-sample-impact') }} + run: bash eng/check-contract-samples.sh diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml new file mode 100644 index 0000000..85f4cba --- /dev/null +++ b/.github/workflows/pull-request.yml @@ -0,0 +1,46 @@ +name: Pull request + +on: + pull_request: + branches: [main] + types: [opened, edited, synchronize, reopened] + +permissions: + contents: read + +concurrency: + group: pull-request-${{ github.event.pull_request.number }} + cancel-in-progress: true + +jobs: + pr-title: + name: pr-title + runs-on: ubuntu-latest + timeout-minutes: 5 + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + + - name: pr-title + env: + PR_TITLE: ${{ github.event.pull_request.title }} + run: bash eng/check-pr-title.sh + + internal-references: + name: internal-references + runs-on: ubuntu-latest + timeout-minutes: 5 + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + fetch-depth: 0 + persist-credentials: false + + - name: internal-references + env: + BASE_SHA: ${{ github.event.pull_request.base.sha }} + HEAD_SHA: ${{ github.event.pull_request.head.sha }} + PR_TITLE: ${{ github.event.pull_request.title }} + PR_BODY: ${{ github.event.pull_request.body }} + run: bash eng/check-internal-references.sh diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml new file mode 100644 index 0000000..f818a4a --- /dev/null +++ b/.github/workflows/scorecard.yml @@ -0,0 +1,42 @@ +name: Scorecard + +on: + branch_protection_rule: + push: + branches: [main] + schedule: + - cron: '41 5 * * 1' + +permissions: + contents: read + +jobs: + analysis: + name: analysis + runs-on: ubuntu-latest + timeout-minutes: 15 + permissions: + actions: read + contents: read + id-token: write + security-events: write + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + + - uses: ossf/scorecard-action@fa7117db83c52d787ae5a89f350999701505d78e # v2.5.0 + with: + results_file: results.sarif + results_format: sarif + publish_results: true + + - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 + with: + name: scorecard-results + path: results.sarif + retention-days: 5 + + - uses: github/codeql-action/upload-sarif@24c54180a607b1449ed407dd24f251e4e9147c8d # v4.38.3 + with: + sarif_file: results.sarif diff --git a/eng/check-contract-samples.sh b/eng/check-contract-samples.sh new file mode 100644 index 0000000..f6fc11f --- /dev/null +++ b/eng/check-contract-samples.sh @@ -0,0 +1,47 @@ +#!/usr/bin/env bash +# A pull request that changes a contract path must also change samples/, unless a maintainer applied no-sample-impact. +set -euo pipefail + +base="${BASE_SHA:?BASE_SHA is required}" +head="${HEAD_SHA:?HEAD_SHA is required}" +accepted="${HAS_NO_SAMPLE_IMPACT_LABEL:-false}" +paths_file="$(dirname "$0")/contract-paths.txt" + +mapfile -t patterns < <(grep -vE '^[[:space:]]*(#|$)' "$paths_file") +mapfile -t changed < <(git diff --name-only "$base...$head") + +contract_changes=() +samples_changed=false +for file in "${changed[@]}"; do + if [[ "$file" == samples/* ]]; then + samples_changed=true + fi + for pattern in "${patterns[@]}"; do + # Unquoted on purpose: the right-hand side is a glob, and * also matches /. + if [[ "$file" == $pattern ]]; then + contract_changes+=("$file") + break + fi + done +done + +if [[ ${#contract_changes[@]} -eq 0 ]]; then + echo "No contract change." + exit 0 +fi + +echo "Contract changes:" +printf ' %s\n' "${contract_changes[@]}" + +if [[ "$samples_changed" == true ]]; then + echo "samples/ was updated in the same pull request." + exit 0 +fi + +if [[ "$accepted" == true ]]; then + echo "Accepted without sample changes: the no-sample-impact label is applied." + exit 0 +fi + +echo "::error::The contract changed but samples/ did not. Update the affected samples, or a maintainer can apply the no-sample-impact label." +exit 1 diff --git a/eng/check-internal-references.sh b/eng/check-internal-references.sh new file mode 100644 index 0000000..d3cdcfc --- /dev/null +++ b/eng/check-internal-references.sh @@ -0,0 +1,33 @@ +#!/usr/bin/env bash +# Fails when the pull request title, its description or one of its commit messages matches an internal-reference pattern. +set -euo pipefail + +base="${BASE_SHA:?BASE_SHA is required}" +head="${HEAD_SHA:?HEAD_SHA is required}" +patterns_file="$(dirname "$0")/internal-references.patterns" + +mapfile -t patterns < <(grep -vE '^[[:space:]]*(#|$)' "$patterns_file") + +status=0 + +check() { + local source="$1" text="$2" pattern match + for pattern in "${patterns[@]}"; do + if match="$(grep -m1 -oP -- "$pattern" <<<"$text")"; then + echo "::error::$source references internal material: '${match%%$'\n'*}'" + status=1 + fi + done +} + +check "The pull request title" "${PR_TITLE:-}" +check "The pull request description" "${PR_BODY:-}" + +while IFS= read -r commit; do + check "Commit ${commit:0:12}" "$(git log -1 --format=%B "$commit")" +done < <(git rev-list "$base..$head") + +if [[ $status -eq 0 ]]; then + echo "No internal references in the pull request title, description or commit messages." +fi +exit $status diff --git a/eng/check-packages.sh b/eng/check-packages.sh new file mode 100644 index 0000000..ce977fe --- /dev/null +++ b/eng/check-packages.sh @@ -0,0 +1,39 @@ +#!/usr/bin/env bash +# Checks the packed output: the expected number of packages and symbol packages, all sharing one version. +set -euo pipefail + +directory="${1:?usage: check-packages.sh [version-regex]}" +expected="${2:?usage: check-packages.sh [version-regex]}" +version_pattern="${3:-}" + +shopt -s nullglob +packages=("$directory"/*.nupkg) +symbols=("$directory"/*.snupkg) + +if [[ ${#packages[@]} -ne $expected ]]; then + echo "::error::Expected $expected packages, found ${#packages[@]}." + exit 1 +fi + +if [[ ${#symbols[@]} -ne $expected ]]; then + echo "::error::Expected $expected symbol packages, found ${#symbols[@]}." + exit 1 +fi + +mapfile -t versions < <( + for package in "${packages[@]}"; do + basename "$package" .nupkg | sed -E 's/^WalterEgo(\.[A-Za-z]+)*\.([0-9].*)$/\2/' + done | sort -u +) + +if [[ ${#versions[@]} -ne 1 ]]; then + echo "::error::The packages do not share one version: ${versions[*]}" + exit 1 +fi + +if [[ -n "$version_pattern" && ! "${versions[0]}" =~ $version_pattern ]]; then + echo "::error::Version ${versions[0]} does not match $version_pattern." + exit 1 +fi + +echo "$expected packages and $expected symbol packages, version ${versions[0]}." diff --git a/eng/check-pr-title.sh b/eng/check-pr-title.sh new file mode 100644 index 0000000..695e81e --- /dev/null +++ b/eng/check-pr-title.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash +# Squash merges turn the pull request title into the commit message, so it must be a Conventional Commit. +set -euo pipefail + +title="${PR_TITLE:?PR_TITLE is required}" +pattern='^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test)(\([a-z0-9][a-z0-9.-]*\))?!?: [^ ].*$' + +if [[ ! "$title" =~ $pattern ]]; then + echo "::error::The pull request title is not a Conventional Commit: '$title'" + echo "Expected '(): ' with one of: build, chore, ci, docs, feat, fix, perf, refactor, revert, style, test." + exit 1 +fi + +echo "The pull request title is a valid Conventional Commit." diff --git a/eng/coverage-summary.sh b/eng/coverage-summary.sh new file mode 100644 index 0000000..739ad4f --- /dev/null +++ b/eng/coverage-summary.sh @@ -0,0 +1,32 @@ +#!/usr/bin/env bash +# Writes the line and branch coverage of each Cobertura report to the job summary. +set -euo pipefail + +directory="${1:?usage: coverage-summary.sh }" +summary="${GITHUB_STEP_SUMMARY:-/dev/stdout}" + +shopt -s nullglob globstar +reports=("$directory"/**/*.cobertura.xml) + +if [[ ${#reports[@]} -eq 0 ]]; then + echo "::error::No Cobertura report found in $directory." + exit 1 +fi + +percent() { + awk -v rate="$1" 'BEGIN { printf "%.1f%%", rate * 100 }' +} + +{ + echo "### Coverage" + echo + echo "| Packages | Lines | Branches |" + echo "|---|---|---|" + for report in "${reports[@]}"; do + root="$(grep -m1 -oE ']*>' "$report")" + line_rate="$(sed -E 's/.*line-rate="([0-9.]+)".*/\1/' <<<"$root")" + branch_rate="$(sed -E 's/.*branch-rate="([0-9.]+)".*/\1/' <<<"$root")" + packages="$(grep -oE ']*name="[^"]+"' "$report" | sed -E 's/.*name="([^"]+)"/\1/' | sort -u | paste -sd ',' - || true)" + echo "| ${packages:-(no instrumented code)} | $(percent "$line_rate") | $(percent "$branch_rate") |" + done +} >>"$summary" From ff59314dda49e107b572ec6f6aa7de752e0e7f20 Mon Sep 17 00:00:00 2001 From: net0well Date: Wed, 21 Oct 2026 17:32:18 -0300 Subject: [PATCH 4/4] docs: add security policy, contributing guide and changelog --- CHANGELOG.md | 8 ++++++++ CONTRIBUTING.md | 51 +++++++++++++++++++++++++++++++++++++++++++++++++ SECURITY.md | 42 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 101 insertions(+) create mode 100644 CHANGELOG.md create mode 100644 CONTRIBUTING.md create mode 100644 SECURITY.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..f660614 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,8 @@ +# Changelog + +All notable changes to this project are documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to +[Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [Unreleased] diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..aba9b45 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,51 @@ +# Contributing to WalterEgo + +Thank you for your interest in WalterEgo! This guide explains how to propose changes. + +This project follows the [ScriptRunnerKit Code of Conduct](https://github.com/ScriptRunnerKit/.github/blob/main/CODE_OF_CONDUCT.md). + +## Before you start + +- **Open an issue first** for a new feature or a change in behavior, so we can agree on the scope before any code is + written. Bug fixes with a clear reproduction can go straight to a pull request. +- **Security issues never go in public issues.** See [SECURITY.md](SECURITY.md). +- WalterEgo is **exclusively defensive**. Contributions that attack, exploit or track the source of a trip ("hack-back") + are not accepted. +- **New dependencies** must be discussed in the issue first: supply chain matters in a security project. + +## Building and testing + +You need exactly the .NET SDK version pinned in [`global.json`](global.json): the package lock files depend on it, and +the CI restores in locked mode. Tests marked with the `Category=Docker` trait also need Docker. + +```bash +dotnet build +dotnet test +dotnet format --verify-no-changes +``` + +The build treats warnings as errors and runs the .NET analyzers, the code style rules, the public API analyzer and the +banned API analyzer. + +## Pull requests + +- The **title** follows [Conventional Commits](https://www.conventionalcommits.org/), for example + `feat(aspnetcore): add honey endpoint sensor`. Pull requests are squash-merged and the title becomes the commit + message. +- The **description** explains what changed, how it was tested and the impact on the public API. +- A change to a **contract** — the public API, the alert event, the configuration or the CLI — updates the affected + [samples](samples) in the same pull request. +- Public API changes are recorded in the project's `PublicAPI.Unshipped.txt`. +- User-visible changes get an entry in the `[Unreleased]` section of [CHANGELOG.md](CHANGELOG.md). +- Tests and samples use clearly fictitious values. Never commit real secrets. + +## Code style + +- Code, identifiers and XML documentation are in English. +- Every public type and member has complete XML documentation. +- Comments explain the non-obvious *why*; they do not repeat what the code says. +- Test names describe the behavior they check. + +## License + +By contributing, you agree that your contributions are licensed under the [MIT License](LICENSE). diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 0000000..e6a4f82 --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,42 @@ +# Security Policy + +## Reporting a vulnerability + +**Please do not report security vulnerabilities through public issues, discussions or pull requests.** + +Report them privately with GitHub's private vulnerability reporting: open the **Security** tab of this repository and +choose **Report a vulnerability**. Only the maintainers can see the report. + +Please include as much as you can of: + +- the affected package and version (or commit); +- a description of the issue and its impact; +- steps to reproduce, a proof of concept or the affected code; +- any known workaround. + +## Scope + +WalterEgo is a defensive tool: it plants decoys (honeytokens) in your application and alerts when someone touches them. +Besides the usual classes of vulnerabilities, the following are security issues in WalterEgo: + +- a decoy that grants real access: a honey user that authenticates, a honey API key that authorizes, a honey session + token that validates; +- decoys, or the presence of WalterEgo itself, that an attacker can recognize (headers, response content, timing, + recognizable generated values, a decoy registry that reveals which values are decoys); +- a way to use a decoy without the trip being detected or reported; +- a failure in WalterEgo (for example, an alert channel that is down or an exception in a sensor) that breaks or changes + the behavior of the host application; +- secrets or decoy values leaking into logs, events or alert payloads. + +A decoy that is fake and exposed on purpose is not a vulnerability: that is how honeytokens work. + +## What to expect + +- We will acknowledge the report as soon as possible, usually within a week. +- We will investigate, keep you informed of the progress and agree on a disclosure date with you. +- Fixes are released as a new version, and a GitHub Security Advisory credits the reporter (unless you prefer to remain + anonymous). + +## Supported versions + +WalterEgo is in preview. Security fixes are made for the latest preview release.