From 466eff291569e7b0c05ae6d0a8bf9630d449b1da Mon Sep 17 00:00:00 2001 From: "codebelt-aicia[bot]" Date: Thu, 15 Oct 2026 17:51:50 +0000 Subject: [PATCH 1/4] V12.0.2/service update --- .../Codebelt.Extensions.Xunit.App/PackageReleaseNotes.txt | 6 ++++++ .../PackageReleaseNotes.txt | 6 ++++++ .../PackageReleaseNotes.txt | 6 ++++++ .nuget/Codebelt.Extensions.Xunit/PackageReleaseNotes.txt | 6 ++++++ CHANGELOG.md | 4 ++++ Directory.Packages.props | 6 +++--- 6 files changed, 31 insertions(+), 3 deletions(-) diff --git a/.nuget/Codebelt.Extensions.Xunit.App/PackageReleaseNotes.txt b/.nuget/Codebelt.Extensions.Xunit.App/PackageReleaseNotes.txt index b900e91..ade76fa 100644 --- a/.nuget/Codebelt.Extensions.Xunit.App/PackageReleaseNotes.txt +++ b/.nuget/Codebelt.Extensions.Xunit.App/PackageReleaseNotes.txt @@ -1,3 +1,9 @@ +Version: 12.0.2 +Availability: .NET 10 and .NET 9 + +# ALM +- CHANGED Dependencies have been upgraded to the latest compatible versions for all supported target frameworks (TFMs) + Version: 12.0.1 Availability: .NET 10 and .NET 9 diff --git a/.nuget/Codebelt.Extensions.Xunit.Hosting.AspNetCore/PackageReleaseNotes.txt b/.nuget/Codebelt.Extensions.Xunit.Hosting.AspNetCore/PackageReleaseNotes.txt index 17e5f7c..1ec735f 100644 --- a/.nuget/Codebelt.Extensions.Xunit.Hosting.AspNetCore/PackageReleaseNotes.txt +++ b/.nuget/Codebelt.Extensions.Xunit.Hosting.AspNetCore/PackageReleaseNotes.txt @@ -1,3 +1,9 @@ +Version: 12.0.2 +Availability: .NET 10 and .NET 9 + +# ALM +- CHANGED Dependencies have been upgraded to the latest compatible versions for all supported target frameworks (TFMs) + Version: 12.0.1 Availability: .NET 10 and .NET 9 diff --git a/.nuget/Codebelt.Extensions.Xunit.Hosting/PackageReleaseNotes.txt b/.nuget/Codebelt.Extensions.Xunit.Hosting/PackageReleaseNotes.txt index efa28b2..e5f3377 100644 --- a/.nuget/Codebelt.Extensions.Xunit.Hosting/PackageReleaseNotes.txt +++ b/.nuget/Codebelt.Extensions.Xunit.Hosting/PackageReleaseNotes.txt @@ -1,3 +1,9 @@ +Version: 12.0.2 +Availability: .NET 10, .NET 9 and .NET Standard 2.0 + +# ALM +- CHANGED Dependencies have been upgraded to the latest compatible versions for all supported target frameworks (TFMs) + Version: 12.0.1 Availability: .NET 10, .NET 9 and .NET Standard 2.0 diff --git a/.nuget/Codebelt.Extensions.Xunit/PackageReleaseNotes.txt b/.nuget/Codebelt.Extensions.Xunit/PackageReleaseNotes.txt index b0861a2..abf8bc4 100644 --- a/.nuget/Codebelt.Extensions.Xunit/PackageReleaseNotes.txt +++ b/.nuget/Codebelt.Extensions.Xunit/PackageReleaseNotes.txt @@ -1,3 +1,9 @@ +Version: 12.0.2 +Availability: .NET 10, .NET 9 and .NET Standard 2.0 + +# ALM +- CHANGED Dependencies have been upgraded to the latest compatible versions for all supported target frameworks (TFMs) + Version: 12.0.1 Availability: .NET 10, .NET 9 and .NET Standard 2.0 diff --git a/CHANGELOG.md b/CHANGELOG.md index c3ff889..3222231 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ For more details, please refer to `PackageReleaseNotes.txt` on a per assembly ba > [!NOTE] > Changelog entries prior to version 8.4.0 was migrated from previous versions of Cuemon.Extensions.Xunit, Cuemon.Extensions.Xunit.Hosting, and Cuemon.Extensions.Xunit.Hosting.AspNetCore. +## [12.0.2] - 2026-10-15 + +This is a service update that focuses on package dependencies. + ## [12.0.1] - 2026-09-11 This is a patch release focused on dependency updates and resource management improvements for .NET 9 and later compatibility. diff --git a/Directory.Packages.props b/Directory.Packages.props index 2b7a56c..be4d93d 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -10,9 +10,9 @@ - - - + + + From 9855020620682fe9d614ab829f2c65c567b58d63 Mon Sep 17 00:00:00 2001 From: gimlichael Date: Fri, 16 Oct 2026 12:45:33 +0200 Subject: [PATCH 2/4] =?UTF-8?q?=F0=9F=93=A6=20Bump=20xUnit=20v4,=20MTP=20a?= =?UTF-8?q?nd=20Microsoft.Extensions=20packages=20and=20move=20agent=20gui?= =?UTF-8?q?dance=20into=20AGENTS.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replaces the Copilot instructions file with AGENTS.md as the single source of agent guidance. 🤖 Generated with Codebuff Co-Authored-By: Codebuff --- .github/copilot-instructions.md | 639 ------------------------------- AGENTS.md | 644 +++++++++++++++++++++++++++++++- Directory.Packages.props | 42 +-- 3 files changed, 653 insertions(+), 672 deletions(-) delete mode 100644 .github/copilot-instructions.md diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md deleted file mode 100644 index 6fcaadb..0000000 --- a/.github/copilot-instructions.md +++ /dev/null @@ -1,639 +0,0 @@ ---- -description: 'Writing Unit Tests' -applyTo: "**/*.{cs,csproj}" ---- - -# Writing Unit Tests -This document provides instructions for writing unit tests for a project/solution. Please follow these guidelines to ensure consistency and maintainability. - -## 1. Base Class - -**Always inherit from the `Test` base class** for all unit test classes. -This ensures consistent setup, teardown, and output handling across all tests. - -> Important: Do NOT add `using Xunit.Abstractions`. xUnit v3 no longer exposes that namespace; including it is incorrect and will cause compilation errors. Use the `Codebelt.Extensions.Xunit` Test base class and `using Xunit;` as shown in the examples below. If you need access to test output, rely on the Test base class (which accepts the appropriate output helper) rather than importing `Xunit.Abstractions`. - -```csharp -using Codebelt.Extensions.Xunit; -using Xunit; - -namespace Your.Namespace; - -public class YourTestClass : Test -{ - public YourTestClass(ITestOutputHelper output) : base(output) - { - } - - // Your tests here -} -``` - -## 2. Test Method Attributes - -- Use `[Fact]` for standard unit tests. -- Use `[Theory]` with `[InlineData]` or other data sources for parameterized tests. - -## 3. Naming Conventions - -- **Test classes**: End with `Test` (e.g., `DateSpanTest`). -- **Test methods**: Use descriptive names that state the expected behavior (e.g., `ShouldReturnTrue_WhenConditionIsMet`). - -## 4. Assertions - -- Use `Assert` methods from xUnit for all assertions. -- Prefer explicit and expressive assertions (e.g., `Assert.Equal`, `Assert.NotNull`, `Assert.Contains`). - -## 5. File and Namespace Organization - -- **Always use file-scoped namespaces** (`namespace YourProject.Foo.Bar;`) — the entire codebase has been refactored to file-scoped namespaces. Never use block-scoped namespaces. -- Place test files in the appropriate test project and folder structure. -- Use namespaces that mirror the source code structure. The namespace of a test file MUST match the namespace of the System Under Test (SUT). Do NOT append ".Tests", ".Benchmarks" or similar suffixes to the namespace. Only the assembly/project name should indicate that the file is a test/benchmark (for example: YourProject.Foo.Tests assembly, but namespace YourProject.Foo). - - Example: If the SUT class is declared as: - ```csharp - namespace YourProject.Foo.Bar; - - public class Zoo { /* ... */ } - ``` - then the corresponding unit test class must use the exact same namespace: - ```csharp - namespace YourProject.Foo.Bar; - - public class ZooTest : Test { /* ... */ } - ``` - - Do NOT use: - ```csharp - namespace YourProject.Foo.Bar.Tests { /* ... */ } // ❌ - namespace YourProject.Foo.Bar.Benchmarks { /* ... */ } // ❌ - ``` - - The unit tests for the YourProject.Foo assembly live in the YourProject.Foo.Tests assembly. - - The functional tests for the YourProject.Foo assembly live in the YourProject.Foo.FunctionalTests assembly. - - Test class names end with Test and live in the same namespace as the class being tested, e.g., the unit tests for the Boo class that resides in the YourProject.Foo assembly would be named BooTest and placed in the YourProject.Foo namespace in the YourProject.Foo.Tests assembly. - - Modify the associated .csproj file to override the root namespace so the compiled namespace matches the SUT. Example: - ```xml - - YourProject.Foo - - ``` -- When generating test scaffolding automatically, resolve the SUT's namespace from the source file (or project/assembly metadata) and use that exact namespace in the test file header. - -- Notes: - - This rule ensures type discovery and XML doc links behave consistently and reduces confusion when reading tests. - - Keep folder structure aligned with the production code layout to make locating SUT <-> test pairs straightforward. - -## 6. Example Test - -```csharp -using System; -using System.Globalization; -using Codebelt.Extensions.Xunit; -using Xunit; - -namespace YourProject; - -/// -/// Tests for the class. -/// -public class DateSpanTest : Test -{ - public DateSpanTest(ITestOutputHelper output) : base(output) - { - } - - [Fact] - public void Parse_ShouldGetOneMonthOfDifference_UsingIso8601String() - { - var start = new DateTime(2021, 3, 5).ToString("O"); - var end = new DateTime(2021, 4, 5).ToString("O"); - - var span = DateSpan.Parse(start, end); - - Assert.Equal("0:01:31:00:00:00.0", span.ToString()); - Assert.Equal(0, span.Years); - Assert.Equal(1, span.Months); - Assert.Equal(31, span.Days); - Assert.Equal(0, span.Hours); - Assert.Equal(0, span.Minutes); - Assert.Equal(0, span.Seconds); - Assert.Equal(0, span.Milliseconds); - - Assert.Equal(0.08493150684931507, span.TotalYears); - Assert.Equal(1, span.TotalMonths); - Assert.Equal(31, span.TotalDays); - Assert.Equal(744, span.TotalHours); - Assert.Equal(44640, span.TotalMinutes); - Assert.Equal(2678400, span.TotalSeconds); - Assert.Equal(2678400000, span.TotalMilliseconds); - - Assert.Equal(6, span.GetWeeks()); - Assert.Equal(-1566296493, span.GetHashCode()); - - TestOutput.WriteLine(span.ToString()); - } -} -``` - -## 7. Additional Guidelines - -- Keep tests focused and isolated. -- Do not rely on external systems except for xUnit itself and Codebelt.Extensions.Xunit (and derived from this). -- Ensure tests are deterministic and repeatable. - -### Microsoft Testing Platform coverage - -- Microsoft.Testing.Platform is the test platform for this repository. -- Use `coverlet.MTP` as the MTP-native coverage engine and OpenCover as the canonical Codebelt coverage format. -- Pin `coverlet.MTP` to `8.0.1` for `net9.0` and `10.0.1` for `net10.0` and `net48`; the test-only net9 `Microsoft.Extensions.Configuration` transitive pin is `10.0.1`, while the shared non-test net9 pin remains `9.0.20`. -- Do not add `coverlet.collector` or `coverlet.msbuild` to MTP-based test projects; they are legacy integrations. -- Do not add `Microsoft.Testing.Extensions.CodeCoverage` as the coverage provider. -- Keep MTP Coverlet coverage on supported modern .NET targets and `net48`; other .NET Framework targets remain test-only unless verified. -- Use `Microsoft.Testing.Extensions.HangDump` for the MTP hang-dump flags forwarded by CI. - -## 8. Test Doubles - -- Preferred test doubles include dummies, fakes, stubs and spies if and when the design allows it. -- Under special circumstances, mock can be used (using Moq library). -- Before overriding methods, verify that the method is virtual or abstract; this rule also applies to mocks. -- Never mock IMarshaller; always use a new instance of JsonMarshaller. - -## 9. Avoid `InternalsVisibleTo` in Tests - -- **Do not** use `InternalsVisibleTo` to access internal types or members from test projects. -- Prefer **indirect testing via public APIs** that depend on the internal implementation (public facades, public extension methods, or other public entry points). - -### Preferred Pattern - -**Pattern name:** Public Facade Testing (also referred to as *Public API Proxy Testing*) - -**Description:** -Internal classes and methods must be validated by exercising the public API that consumes them. Tests should assert observable behavior exposed by the public surface rather than targeting internal implementation details directly. - -### Example Mapping - -- **Internal helper:** `DelimitedString` (internal static class) -- **Public API:** `TestOutputHelperExtensions.WriteLines()` (public extension method) -- **Test strategy:** Write tests for `WriteLines()` and verify its public behavior. The internal call to `DelimitedString.Create()` is exercised implicitly. - -### Benefits - -- Avoids exposing internal types to test assemblies. -- Ensures tests reflect real-world usage patterns. -- Maintains strong encapsulation and a clean public API. -- Tests remain resilient to internal refactoring as long as public behavior is preserved. - -### When to Apply - -- Internal logic is fully exercised through existing public APIs. -- Public entry points provide sufficient coverage of internal code paths. -- The internal implementation exists solely as a helper or utility for public-facing functionality. - -## 10. ExcludeFromCodeCoverage Prohibition - -**Do not use `ExcludeFromCodeCoverage` attribute on any code.** This includes: - -- Test classes or test methods -- Production code -- Configuration code -- Any other code path - -### Rationale - -- Excluding code from coverage hides gaps and creates false confidence in test completeness. -- If a code path cannot or should not be tested, refactor the code to eliminate that path rather than hiding it from metrics. -- Every executable line should be covered by tests or be genuinely unreachable (dead code to be removed). - -### Alternative Approaches - -- **Untestable code paths**: Refactor to separate concerns and eliminate the untestable path. -- **External dependencies**: Use test doubles (fakes, stubs, spies) instead of excluding from coverage. -- **Configuration-only code**: Move to configuration files or extract into testable methods. -- **Generated or third-party code**: These should not be in the primary codebase; use NuGet packages or dedicated vendor folders if necessary. - ---- -description: 'Writing Performance Tests' -applyTo: "tuning/**, **/*Benchmark*.cs" ---- - -# Writing Performance Tests -This document provides guidance for writing performance tests (benchmarks) for a project/solution using BenchmarkDotNet. Follow these guidelines to keep benchmarks consistent, readable, and comparable. - -## 1. Naming and Placement - -- Place micro- and component-benchmarks under the `tuning/` folder or in projects named `*.Benchmarks`. -- Place benchmark files in the appropriate benchmark project and folder structure. -- Use namespaces that mirror the source code structure, e.g. do not suffix with `Benchmarks`. -Namespace rule: DO NOT append `.Benchmarks` to the namespace. Benchmarks must live in the same namespace as the production assembly. Example: if the production assembly uses `namespace YourProject.Security.Cryptography`, the benchmark file should also use: - ``` - namespace YourProject.Security.Cryptography - { - public class Sha512256Benchmark { /* ... */ } - } - ``` -The class name must end with `Benchmark`, but the namespace must match the assembly (no `.Benchmarks` suffix). -- The benchmarks for the YourProject.Bar assembly live in the YourProject.Bar.Benchmarks assembly. -- Benchmark class names end with Benchmark and live in the same namespace as the class being measured, e.g., the benchmarks for the Zoo class that resides in the YourProject.Bar assembly would be named ZooBenchmark and placed in the YourProject.Bar namespace in the YourProject.Bar.Benchmarks assembly. -- Modify the associated .csproj file to override the root namespace, e.g., YourProject.Bar. - -## 2. Attributes and Configuration - -- Use `BenchmarkDotNet` attributes to express intent and collect relevant metrics: - - `[MemoryDiagnoser]` to capture memory allocations. - - `[GroupBenchmarksBy(BenchmarkLogicalGroupRule.ByCategory)]` to group related benchmarks. - - `[Params]` for input sizes or variations to exercise multiple scenarios. - - `[GlobalSetup]` for one-time initialization that's not part of measured work. - - `[Benchmark]` on methods representing measured operations; consider `Baseline = true` and `Description` to improve report clarity. -- Keep benchmark configuration minimal and explicit; prefer in-class attributes over large shared configs unless re-used widely. - -## 3. Structure and Best Practices - -- Keep benchmarks focused: each `Benchmark` method should measure a single logical operation. -- Avoid doing expensive setup work inside a measured method; use `[GlobalSetup]`, `[IterationSetup]`, or cached fields instead. -- Use `Params` to cover micro, mid and macro input sizes (for example: small, medium, large) and verify performance trends across them. -- Use small, deterministic data sets and avoid external systems (network, disk, DB). If external systems are necessary, mark them clearly and do not include them in CI benchmark runs by default. -- Capture results that are meaningful: time, allocations, and if needed custom counters. Prefer `MemoryDiagnoser` and descriptive `Description` values. - -## 4. Naming Conventions for Methods - -- Method names should be descriptive and indicate the scenario, e.g., `Parse_Short`, `ComputeHash_Large`. -- When comparing implementations, mark one method with `Baseline = true` and use similar names so reports are easy to read. - -## 5. Example Benchmark - -```csharp -using BenchmarkDotNet.Attributes; -using BenchmarkDotNet.Configs; - -namespace YourProject -{ - [MemoryDiagnoser] - [GroupBenchmarksBy(BenchmarkLogicalGroupRule.ByCategory)] - public class SampleOperationBenchmark - { - [Params(8, 256, 4096)] - public int Count { get; set; } - - private byte[] _payload; - - [GlobalSetup] - public void Setup() - { - _payload = new byte[Count]; - // deterministic initialization - } - - [Benchmark(Baseline = true, Description = "Operation - baseline")] - public int Operation_Baseline() => SampleOperation.Process(_payload); - - [Benchmark(Description = "Operation - optimized")] - public int Operation_Optimized() => SampleOperation.ProcessOptimized(_payload); - } -} -``` - -## 6. Reporting and CI - -- Benchmarks are primarily for local and tuning runs; be cautious about running heavy BenchmarkDotNet workloads in CI. Prefer targeted runs or harnesses for CI where appropriate. -- Keep benchmark projects isolated (e.g., `tuning/*.csproj`) so they don't affect package builds or production artifacts. - -## 7. Additional Guidelines - -- Keep benchmarks readable and well-documented; add comments explaining non-obvious choices. -- If a benchmark exposes regressions or optimizations, add a short note in the benchmark file referencing the relevant issue or PR. -- For any shared helpers for benchmarking, prefer small utility classes inside the `tuning` projects rather than cross-cutting changes to production code. - -For further examples, refer to the benchmark files under the `tuning/` folder. - ---- -description: 'Writing XML documentation' -applyTo: "**/*.cs" ---- - -# Writing XML documentation -This document provides instructions for writing XML documentation. - -## 1. Documentation Style - -- Use the same documentation style as found throughout the codebase. -- Add XML doc comments to public and protected classes and methods where appropriate. -- Example: - -```csharp -using System; -using System.Collections.Generic; -using System.IO; -using Cuemon.Collections.Generic; -using Cuemon.Configuration; -using Cuemon.IO; -using Cuemon.Text; - -namespace Cuemon.Security -{ - /// - /// Represents the base class from which all implementations of hash algorithms and checksums should derive. - /// - /// The type of the configured options. - /// - /// - /// - public abstract class Hash : Hash, IConfigurable where TOptions : ConvertibleOptions, new() - { - /// - /// Initializes a new instance of the class. - /// - /// The which may be configured. - protected Hash(Action setup) - { - Options = Patterns.Configure(setup); - } - - /// - /// Gets the configured options of this instance. - /// - /// The configured options of this instance. - public TOptions Options { get; } - - - /// - /// The endian-initializer of this instance. - /// - /// An instance of the configured options. - protected sealed override void EndianInitializer(EndianOptions options) - { - options.ByteOrder = Options.ByteOrder; - } - } - - /// - /// Represents the base class that defines the public facing structure to expose. - /// - /// - public abstract class Hash : IHash - { - /// - /// Initializes a new instance of the class. - /// - protected Hash() - { - } - - /// - /// Computes the hash value for the specified . - /// - /// The to compute the hash code for. - /// A containing the computed hash code of the specified . - public virtual HashResult ComputeHash(bool input) - { - return ComputeHash(Convertible.GetBytes(input, EndianInitializer)); - } - - /// - /// Computes the hash value for the specified . - /// - /// The to compute the hash code for. - /// A containing the computed hash code of the specified . - public virtual HashResult ComputeHash(byte input) - { - return ComputeHash(Convertible.GetBytes(input, EndianInitializer)); - } - - /// - /// Computes the hash value for the specified . - /// - /// The to compute the hash code for. - /// A containing the computed hash code of the specified . - public virtual HashResult ComputeHash(char input) - { - return ComputeHash(Convertible.GetBytes(input, EndianInitializer)); - } - - /// - /// Computes the hash value for the specified . - /// - /// The to compute the hash code for. - /// A containing the computed hash code of the specified . - public virtual HashResult ComputeHash(DateTime input) - { - return ComputeHash(Convertible.GetBytes(input)); - } - - /// - /// Computes the hash value for the specified . - /// - /// The to compute the hash code for. - /// A containing the computed hash code of the specified . - public virtual HashResult ComputeHash(DBNull input) - { - return ComputeHash(Convertible.GetBytes(input)); - } - - /// - /// Computes the hash value for the specified . - /// - /// The to compute the hash code for. - /// A containing the computed hash code of the specified . - public virtual HashResult ComputeHash(decimal input) - { - return ComputeHash(Convertible.GetBytes(input)); - } - - /// - /// Computes the hash value for the specified . - /// - /// The to compute the hash code for. - /// A containing the computed hash code of the specified . - public virtual HashResult ComputeHash(double input) - { - return ComputeHash(Convertible.GetBytes(input, EndianInitializer)); - } - - /// - /// Computes the hash value for the specified . - /// - /// The to compute the hash code for. - /// A containing the computed hash code of the specified . - public virtual HashResult ComputeHash(short input) - { - return ComputeHash(Convertible.GetBytes(input, EndianInitializer)); - } - - /// - /// Computes the hash value for the specified . - /// - /// The to compute the hash code for. - /// A containing the computed hash code of the specified . - public virtual HashResult ComputeHash(int input) - { - return ComputeHash(Convertible.GetBytes(input, EndianInitializer)); - } - - /// - /// Computes the hash value for the specified . - /// - /// The to compute the hash code for. - /// A containing the computed hash code of the specified . - public virtual HashResult ComputeHash(long input) - { - return ComputeHash(Convertible.GetBytes(input, EndianInitializer)); - } - - /// - /// Computes the hash value for the specified . - /// - /// The to compute the hash code for. - /// A containing the computed hash code of the specified . - public virtual HashResult ComputeHash(sbyte input) - { - return ComputeHash(Convertible.GetBytes(input, EndianInitializer)); - } - - /// - /// Computes the hash value for the specified . - /// - /// The to compute the hash code for. - /// A containing the computed hash code of the specified . - public virtual HashResult ComputeHash(float input) - { - return ComputeHash(Convertible.GetBytes(input, EndianInitializer)); - } - - /// - /// Computes the hash value for the specified . - /// - /// The to compute the hash code for. - /// A containing the computed hash code of the specified . - public virtual HashResult ComputeHash(ushort input) - { - return ComputeHash(Convertible.GetBytes(input, EndianInitializer)); - } - - /// - /// Computes the hash value for the specified . - /// - /// The to compute the hash code for. - /// A containing the computed hash code of the specified . - public virtual HashResult ComputeHash(uint input) - { - return ComputeHash(Convertible.GetBytes(input, EndianInitializer)); - } - - /// - /// Computes the hash value for the specified . - /// - /// The to compute the hash code for. - /// A containing the computed hash code of the specified . - public virtual HashResult ComputeHash(ulong input) - { - return ComputeHash(Convertible.GetBytes(input, EndianInitializer)); - } - - /// - /// Computes the hash value for the specified . - /// - /// The to compute the hash code for. - /// The which may be configured. - /// A containing the computed hash code of the specified . - public virtual HashResult ComputeHash(string input, Action setup = null) - { - return ComputeHash(Convertible.GetBytes(input, setup)); - } - - /// - /// Computes the hash value for the specified . - /// - /// The to compute the hash code for. - /// A containing the computed hash code of the specified . - public virtual HashResult ComputeHash(Enum input) - { - return ComputeHash(Convertible.GetBytes(input, EndianInitializer)); - } - - /// - /// Computes the hash value for the specified . - /// - /// The to compute the hash code for. - /// A containing the computed hash code of the specified . - public virtual HashResult ComputeHash(params IConvertible[] input) - { - return ComputeHash(Arguments.ToEnumerableOf(input)); - } - - /// - /// Computes the hash value for the specified sequence of . - /// - /// The sequence of to compute the hash code for. - /// A containing the computed hash code of the specified . - public virtual HashResult ComputeHash(IEnumerable input) - { - return ComputeHash(Convertible.GetBytes(input)); - } - - /// - /// Computes the hash value for the specified . - /// - /// The to compute the hash code for. - /// A containing the computed hash code of the specified . - public abstract HashResult ComputeHash(byte[] input); - - /// - /// Computes the hash value for the specified . - /// - /// The to compute the hash code for. - /// A containing the computed hash code of the specified . - public virtual HashResult ComputeHash(Stream input) - { - return ComputeHash(Patterns.SafeInvoke(() => new MemoryStream(), destination => - { - Decorator.Enclose(input).CopyStream(destination); - return destination; - }).ToArray()); - } - - /// - /// Defines the initializer that must implement. - /// - /// An instance of the configured options. - protected abstract void EndianInitializer(EndianOptions options); - } -} - -namespace Cuemon.Security -{ - /// - /// Configuration options for . - /// - public class FowlerNollVoOptions : ConvertibleOptions - { - /// - /// Initializes a new instance of the class. - /// - /// - /// The following table shows the initial property values for an instance of . - /// - /// - /// Property - /// Initial Value - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - public FowlerNollVoOptions() - { - Algorithm = FowlerNollVoAlgorithm.Fnv1a; - ByteOrder = Endianness.BigEndian; - } - - /// - /// Gets or sets the algorithm of the Fowler-Noll-Vo hash function. - /// - /// The algorithm of the Fowler-Noll-Vo hash function. - public FowlerNollVoAlgorithm Algorithm { get; set; } - } -} -``` diff --git a/AGENTS.md b/AGENTS.md index ffa993f..f8ff3db 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -74,10 +74,10 @@ dotnet test --project test/Codebelt.Extensions.Xunit.Tests --framework net10.0 - - Live under `tuning/`; run with `tooling/benchmark-runner`. - Not unit tests; do not include in test runs. -## Cursor / Copilot Rules +## Agent Rules - No Cursor rules (`.cursor/rules/` and `.cursorrules` are absent). -- Copilot rules live in `.github/copilot-instructions.md` — **must follow**. +- Detailed rules are included in the scoped guidance below — **must follow**. ## Code Style and Conventions @@ -129,12 +129,10 @@ using Codebelt.Extensions.Xunit; using Xunit; -namespace Codebelt.Extensions.Xunit // Same as SUT +namespace Codebelt.Extensions.Xunit; // Same as SUT +public class YourTestClass : Test { - public class YourTestClass : Test - { - public YourTestClass(ITestOutputHelper output) : base(output) { } - } + public YourTestClass(ITestOutputHelper output) : base(output) { } } ``` @@ -290,13 +288,13 @@ Example: `✨ Add Test.Match wildcard overload` 5. Run targeted tests when changing logic. 6. Keep changes minimal and consistent with existing local style. -## Copilot Instructions +## Detailed Instructions -See `.github/copilot-instructions.md` for detailed guidelines on: +Follow the scoped guidance in this file: -- Writing unit tests -- Writing performance tests (BenchmarkDotNet) -- Writing XML documentation +- [Writing Unit Tests](#writing-unit-tests) +- [Writing Performance Tests](#writing-performance-tests) (BenchmarkDotNet) +- [Writing XML documentation](#writing-xml-documentation) @@ -361,3 +359,625 @@ The final DocFX verification must run outside the working tree when possible. Th If a command cannot be run, report the exact limitation or failure instead of claiming the documentation was verified. + +## Writing Unit Tests + +Applicability: Writing Unit Tests guidance applies to `**/*.{cs,csproj}`. +This document provides instructions for writing unit tests for a project/solution. Please follow these guidelines to ensure consistency and maintainability. + +### 1. Base Class + +**Always inherit from the `Test` base class** for all unit test classes. +This ensures consistent setup, teardown, and output handling across all tests. + +> Important: Do NOT add `using Xunit.Abstractions`. xUnit v3 no longer exposes that namespace; including it is incorrect and will cause compilation errors. Use the `Codebelt.Extensions.Xunit` Test base class and `using Xunit;` as shown in the examples below. If you need access to test output, rely on the Test base class (which accepts the appropriate output helper) rather than importing `Xunit.Abstractions`. + +```csharp +using Codebelt.Extensions.Xunit; +using Xunit; + +namespace Your.Namespace; + +public class YourTestClass : Test +{ + public YourTestClass(ITestOutputHelper output) : base(output) + { + } + + // Your tests here +} +``` + +### 2. Test Method Attributes + +- Use `[Fact]` for standard unit tests. +- Use `[Theory]` with `[InlineData]` or other data sources for parameterized tests. + +### 3. Naming Conventions + +- **Test classes**: End with `Test` (e.g., `DateSpanTest`). +- **Test methods**: Use descriptive names that state the expected behavior (e.g., `ShouldReturnTrue_WhenConditionIsMet`). + +### 4. Assertions + +- Use `Assert` methods from xUnit for all assertions. +- Prefer explicit and expressive assertions (e.g., `Assert.Equal`, `Assert.NotNull`, `Assert.Contains`). + +### 5. File and Namespace Organization + +- **Always use file-scoped namespaces** (`namespace YourProject.Foo.Bar;`) — the entire codebase has been refactored to file-scoped namespaces. Never use block-scoped namespaces. +- Place test files in the appropriate test project and folder structure. +- Use namespaces that mirror the source code structure. The namespace of a test file MUST match the namespace of the System Under Test (SUT). Do NOT append ".Tests", ".Benchmarks" or similar suffixes to the namespace. Only the assembly/project name should indicate that the file is a test/benchmark (for example: YourProject.Foo.Tests assembly, but namespace YourProject.Foo). + - Example: If the SUT class is declared as: + ```csharp + namespace YourProject.Foo.Bar; + + public class Zoo { /* ... */ } + ``` + then the corresponding unit test class must use the exact same namespace: + ```csharp + namespace YourProject.Foo.Bar; + + public class ZooTest : Test { /* ... */ } + ``` + - Do NOT use: + ```csharp + namespace YourProject.Foo.Bar.Tests { /* ... */ } // ❌ + namespace YourProject.Foo.Bar.Benchmarks { /* ... */ } // ❌ + ``` + - The unit tests for the YourProject.Foo assembly live in the YourProject.Foo.Tests assembly. + - The functional tests for the YourProject.Foo assembly live in the YourProject.Foo.FunctionalTests assembly. + - Test class names end with Test and live in the same namespace as the class being tested, e.g., the unit tests for the Boo class that resides in the YourProject.Foo assembly would be named BooTest and placed in the YourProject.Foo namespace in the YourProject.Foo.Tests assembly. + - Modify the associated .csproj file to override the root namespace so the compiled namespace matches the SUT. Example: + ```xml + + YourProject.Foo + + ``` +- When generating test scaffolding automatically, resolve the SUT's namespace from the source file (or project/assembly metadata) and use that exact namespace in the test file header. + +- Notes: + - This rule ensures type discovery and XML doc links behave consistently and reduces confusion when reading tests. + - Keep folder structure aligned with the production code layout to make locating SUT <-> test pairs straightforward. + +### 6. Example Test + +```csharp +using System; +using System.Globalization; +using Codebelt.Extensions.Xunit; +using Xunit; + +namespace YourProject; + +/// +/// Tests for the class. +/// +public class DateSpanTest : Test +{ + public DateSpanTest(ITestOutputHelper output) : base(output) + { + } + + [Fact] + public void Parse_ShouldGetOneMonthOfDifference_UsingIso8601String() + { + var start = new DateTime(2021, 3, 5).ToString("O"); + var end = new DateTime(2021, 4, 5).ToString("O"); + + var span = DateSpan.Parse(start, end); + + Assert.Equal("0:01:31:00:00:00.0", span.ToString()); + Assert.Equal(0, span.Years); + Assert.Equal(1, span.Months); + Assert.Equal(31, span.Days); + Assert.Equal(0, span.Hours); + Assert.Equal(0, span.Minutes); + Assert.Equal(0, span.Seconds); + Assert.Equal(0, span.Milliseconds); + + Assert.Equal(0.08493150684931507, span.TotalYears); + Assert.Equal(1, span.TotalMonths); + Assert.Equal(31, span.TotalDays); + Assert.Equal(744, span.TotalHours); + Assert.Equal(44640, span.TotalMinutes); + Assert.Equal(2678400, span.TotalSeconds); + Assert.Equal(2678400000, span.TotalMilliseconds); + + Assert.Equal(6, span.GetWeeks()); + Assert.Equal(-1566296493, span.GetHashCode()); + + TestOutput.WriteLine(span.ToString()); + } +} +``` + +### 7. Additional Guidelines + +- Keep tests focused and isolated. +- Do not rely on external systems except for xUnit itself and Codebelt.Extensions.Xunit (and derived from this). +- Ensure tests are deterministic and repeatable. + +#### Microsoft Testing Platform coverage + +- Microsoft.Testing.Platform is the test platform for this repository. +- Use `coverlet.MTP` as the MTP-native coverage engine and OpenCover as the canonical Codebelt coverage format. +- Pin `coverlet.MTP` to `8.0.1` for `net9.0` and `10.0.1` for `net10.0` and `net48`; the test-only net9 `Microsoft.Extensions.Configuration` transitive pin is `10.0.1`, while the shared non-test net9 pin remains `9.0.20`. +- Do not add `coverlet.collector` or `coverlet.msbuild` to MTP-based test projects; they are legacy integrations. +- Do not add `Microsoft.Testing.Extensions.CodeCoverage` as the coverage provider. +- Keep MTP Coverlet coverage on supported modern .NET targets and `net48`; other .NET Framework targets remain test-only unless verified. +- Use `Microsoft.Testing.Extensions.HangDump` for the MTP hang-dump flags forwarded by CI. + +### 8. Test Doubles + +- Preferred test doubles include dummies, fakes, stubs and spies if and when the design allows it. +- Under special circumstances, mock can be used (using Moq library). +- Before overriding methods, verify that the method is virtual or abstract; this rule also applies to mocks. +- Never mock IMarshaller; always use a new instance of JsonMarshaller. + +### 9. Avoid `InternalsVisibleTo` in Tests + +- **Do not** use `InternalsVisibleTo` to access internal types or members from test projects. +- Prefer **indirect testing via public APIs** that depend on the internal implementation (public facades, public extension methods, or other public entry points). + +#### Preferred Pattern + +**Pattern name:** Public Facade Testing (also referred to as *Public API Proxy Testing*) + +**Description:** +Internal classes and methods must be validated by exercising the public API that consumes them. Tests should assert observable behavior exposed by the public surface rather than targeting internal implementation details directly. + +#### Example Mapping + +- **Internal helper:** `DelimitedString` (internal static class) +- **Public API:** `TestOutputHelperExtensions.WriteLines()` (public extension method) +- **Test strategy:** Write tests for `WriteLines()` and verify its public behavior. The internal call to `DelimitedString.Create()` is exercised implicitly. + +#### Benefits + +- Avoids exposing internal types to test assemblies. +- Ensures tests reflect real-world usage patterns. +- Maintains strong encapsulation and a clean public API. +- Tests remain resilient to internal refactoring as long as public behavior is preserved. + +#### When to Apply + +- Internal logic is fully exercised through existing public APIs. +- Public entry points provide sufficient coverage of internal code paths. +- The internal implementation exists solely as a helper or utility for public-facing functionality. + +### 10. ExcludeFromCodeCoverage Prohibition + +**Do not use `ExcludeFromCodeCoverage` attribute on any code.** This includes: + +- Test classes or test methods +- Production code +- Configuration code +- Any other code path + +#### Rationale + +- Excluding code from coverage hides gaps and creates false confidence in test completeness. +- If a code path cannot or should not be tested, refactor the code to eliminate that path rather than hiding it from metrics. +- Every executable line should be covered by tests or be genuinely unreachable (dead code to be removed). + +#### Alternative Approaches + +- **Untestable code paths**: Refactor to separate concerns and eliminate the untestable path. +- **External dependencies**: Use test doubles (fakes, stubs, spies) instead of excluding from coverage. +- **Configuration-only code**: Move to configuration files or extract into testable methods. +- **Generated or third-party code**: These should not be in the primary codebase; use NuGet packages or dedicated vendor folders if necessary. + +## Writing Performance Tests + +Applicability: Writing Performance Tests guidance applies to `tuning/**, **/*Benchmark*.cs`. +This document provides guidance for writing performance tests (benchmarks) for a project/solution using BenchmarkDotNet. Follow these guidelines to keep benchmarks consistent, readable, and comparable. + +### 1. Naming and Placement + +- Place micro- and component-benchmarks under the `tuning/` folder or in projects named `*.Benchmarks`. +- Place benchmark files in the appropriate benchmark project and folder structure. +- Use namespaces that mirror the source code structure, e.g. do not suffix with `Benchmarks`. +Namespace rule: DO NOT append `.Benchmarks` to the namespace. Benchmarks must live in the same namespace as the production assembly. Example: if the production assembly uses `namespace YourProject.Security.Cryptography`, the benchmark file should also use: + ``` + namespace YourProject.Security.Cryptography; + public class Sha512256Benchmark { /* ... */ } + ``` +The class name must end with `Benchmark`, but the namespace must match the assembly (no `.Benchmarks` suffix). +- The benchmarks for the YourProject.Bar assembly live in the YourProject.Bar.Benchmarks assembly. +- Benchmark class names end with Benchmark and live in the same namespace as the class being measured, e.g., the benchmarks for the Zoo class that resides in the YourProject.Bar assembly would be named ZooBenchmark and placed in the YourProject.Bar namespace in the YourProject.Bar.Benchmarks assembly. +- Modify the associated .csproj file to override the root namespace, e.g., YourProject.Bar. + +### 2. Attributes and Configuration + +- Use `BenchmarkDotNet` attributes to express intent and collect relevant metrics: + - `[MemoryDiagnoser]` to capture memory allocations. + - `[GroupBenchmarksBy(BenchmarkLogicalGroupRule.ByCategory)]` to group related benchmarks. + - `[Params]` for input sizes or variations to exercise multiple scenarios. + - `[GlobalSetup]` for one-time initialization that's not part of measured work. + - `[Benchmark]` on methods representing measured operations; consider `Baseline = true` and `Description` to improve report clarity. +- Keep benchmark configuration minimal and explicit; prefer in-class attributes over large shared configs unless re-used widely. + +### 3. Structure and Best Practices + +- Keep benchmarks focused: each `Benchmark` method should measure a single logical operation. +- Avoid doing expensive setup work inside a measured method; use `[GlobalSetup]`, `[IterationSetup]`, or cached fields instead. +- Use `Params` to cover micro, mid and macro input sizes (for example: small, medium, large) and verify performance trends across them. +- Use small, deterministic data sets and avoid external systems (network, disk, DB). If external systems are necessary, mark them clearly and do not include them in CI benchmark runs by default. +- Capture results that are meaningful: time, allocations, and if needed custom counters. Prefer `MemoryDiagnoser` and descriptive `Description` values. + +### 4. Naming Conventions for Methods + +- Method names should be descriptive and indicate the scenario, e.g., `Parse_Short`, `ComputeHash_Large`. +- When comparing implementations, mark one method with `Baseline = true` and use similar names so reports are easy to read. + +### 5. Example Benchmark + +```csharp +using BenchmarkDotNet.Attributes; +using BenchmarkDotNet.Configs; + +namespace YourProject; +[MemoryDiagnoser] +[GroupBenchmarksBy(BenchmarkLogicalGroupRule.ByCategory)] +public class SampleOperationBenchmark +{ + [Params(8, 256, 4096)] + public int Count { get; set; } + + private byte[] _payload; + + [GlobalSetup] + public void Setup() + { + _payload = new byte[Count]; + // deterministic initialization + } + + [Benchmark(Baseline = true, Description = "Operation - baseline")] + public int Operation_Baseline() => SampleOperation.Process(_payload); + + [Benchmark(Description = "Operation - optimized")] + public int Operation_Optimized() => SampleOperation.ProcessOptimized(_payload); +} +``` + +### 6. Reporting and CI + +- Benchmarks are primarily for local and tuning runs; be cautious about running heavy BenchmarkDotNet workloads in CI. Prefer targeted runs or harnesses for CI where appropriate. +- Keep benchmark projects isolated (e.g., `tuning/*.csproj`) so they don't affect package builds or production artifacts. + +### 7. Additional Guidelines + +- Keep benchmarks readable and well-documented; add comments explaining non-obvious choices. +- If a benchmark exposes regressions or optimizations, add a short note in the benchmark file referencing the relevant issue or PR. +- For any shared helpers for benchmarking, prefer small utility classes inside the `tuning` projects rather than cross-cutting changes to production code. + +For further examples, refer to the benchmark files under the `tuning/` folder. + +## Writing XML documentation + +Applicability: Writing XML documentation guidance applies to `**/*.cs`. +This document provides instructions for writing XML documentation. + +### 1. Documentation Style + +- Use the same documentation style as found throughout the codebase. +- Add XML doc comments to public and protected classes and methods where appropriate. +- Example: + +```csharp +using System; +using System.Collections.Generic; +using System.IO; +using Cuemon.Collections.Generic; +using Cuemon.Configuration; +using Cuemon.IO; +using Cuemon.Text; + +namespace Cuemon.Security; +/// +/// Represents the base class from which all implementations of hash algorithms and checksums should derive. +/// +/// The type of the configured options. +/// +/// +/// +public abstract class Hash : Hash, IConfigurable where TOptions : ConvertibleOptions, new() +{ + /// + /// Initializes a new instance of the class. + /// + /// The which may be configured. + protected Hash(Action setup) + { + Options = Patterns.Configure(setup); + } + + /// + /// Gets the configured options of this instance. + /// + /// The configured options of this instance. + public TOptions Options { get; } + + + /// + /// The endian-initializer of this instance. + /// + /// An instance of the configured options. + protected sealed override void EndianInitializer(EndianOptions options) + { + options.ByteOrder = Options.ByteOrder; + } +} + +/// +/// Represents the base class that defines the public facing structure to expose. +/// +/// +public abstract class Hash : IHash +{ + /// + /// Initializes a new instance of the class. + /// + protected Hash() + { + } + + /// + /// Computes the hash value for the specified . + /// + /// The to compute the hash code for. + /// A containing the computed hash code of the specified . + public virtual HashResult ComputeHash(bool input) + { + return ComputeHash(Convertible.GetBytes(input, EndianInitializer)); + } + + /// + /// Computes the hash value for the specified . + /// + /// The to compute the hash code for. + /// A containing the computed hash code of the specified . + public virtual HashResult ComputeHash(byte input) + { + return ComputeHash(Convertible.GetBytes(input, EndianInitializer)); + } + + /// + /// Computes the hash value for the specified . + /// + /// The to compute the hash code for. + /// A containing the computed hash code of the specified . + public virtual HashResult ComputeHash(char input) + { + return ComputeHash(Convertible.GetBytes(input, EndianInitializer)); + } + + /// + /// Computes the hash value for the specified . + /// + /// The to compute the hash code for. + /// A containing the computed hash code of the specified . + public virtual HashResult ComputeHash(DateTime input) + { + return ComputeHash(Convertible.GetBytes(input)); + } + + /// + /// Computes the hash value for the specified . + /// + /// The to compute the hash code for. + /// A containing the computed hash code of the specified . + public virtual HashResult ComputeHash(DBNull input) + { + return ComputeHash(Convertible.GetBytes(input)); + } + + /// + /// Computes the hash value for the specified . + /// + /// The to compute the hash code for. + /// A containing the computed hash code of the specified . + public virtual HashResult ComputeHash(decimal input) + { + return ComputeHash(Convertible.GetBytes(input)); + } + + /// + /// Computes the hash value for the specified . + /// + /// The to compute the hash code for. + /// A containing the computed hash code of the specified . + public virtual HashResult ComputeHash(double input) + { + return ComputeHash(Convertible.GetBytes(input, EndianInitializer)); + } + + /// + /// Computes the hash value for the specified . + /// + /// The to compute the hash code for. + /// A containing the computed hash code of the specified . + public virtual HashResult ComputeHash(short input) + { + return ComputeHash(Convertible.GetBytes(input, EndianInitializer)); + } + + /// + /// Computes the hash value for the specified . + /// + /// The to compute the hash code for. + /// A containing the computed hash code of the specified . + public virtual HashResult ComputeHash(int input) + { + return ComputeHash(Convertible.GetBytes(input, EndianInitializer)); + } + + /// + /// Computes the hash value for the specified . + /// + /// The to compute the hash code for. + /// A containing the computed hash code of the specified . + public virtual HashResult ComputeHash(long input) + { + return ComputeHash(Convertible.GetBytes(input, EndianInitializer)); + } + + /// + /// Computes the hash value for the specified . + /// + /// The to compute the hash code for. + /// A containing the computed hash code of the specified . + public virtual HashResult ComputeHash(sbyte input) + { + return ComputeHash(Convertible.GetBytes(input, EndianInitializer)); + } + + /// + /// Computes the hash value for the specified . + /// + /// The to compute the hash code for. + /// A containing the computed hash code of the specified . + public virtual HashResult ComputeHash(float input) + { + return ComputeHash(Convertible.GetBytes(input, EndianInitializer)); + } + + /// + /// Computes the hash value for the specified . + /// + /// The to compute the hash code for. + /// A containing the computed hash code of the specified . + public virtual HashResult ComputeHash(ushort input) + { + return ComputeHash(Convertible.GetBytes(input, EndianInitializer)); + } + + /// + /// Computes the hash value for the specified . + /// + /// The to compute the hash code for. + /// A containing the computed hash code of the specified . + public virtual HashResult ComputeHash(uint input) + { + return ComputeHash(Convertible.GetBytes(input, EndianInitializer)); + } + + /// + /// Computes the hash value for the specified . + /// + /// The to compute the hash code for. + /// A containing the computed hash code of the specified . + public virtual HashResult ComputeHash(ulong input) + { + return ComputeHash(Convertible.GetBytes(input, EndianInitializer)); + } + + /// + /// Computes the hash value for the specified . + /// + /// The to compute the hash code for. + /// The which may be configured. + /// A containing the computed hash code of the specified . + public virtual HashResult ComputeHash(string input, Action setup = null) + { + return ComputeHash(Convertible.GetBytes(input, setup)); + } + + /// + /// Computes the hash value for the specified . + /// + /// The to compute the hash code for. + /// A containing the computed hash code of the specified . + public virtual HashResult ComputeHash(Enum input) + { + return ComputeHash(Convertible.GetBytes(input, EndianInitializer)); + } + + /// + /// Computes the hash value for the specified . + /// + /// The to compute the hash code for. + /// A containing the computed hash code of the specified . + public virtual HashResult ComputeHash(params IConvertible[] input) + { + return ComputeHash(Arguments.ToEnumerableOf(input)); + } + + /// + /// Computes the hash value for the specified sequence of . + /// + /// The sequence of to compute the hash code for. + /// A containing the computed hash code of the specified . + public virtual HashResult ComputeHash(IEnumerable input) + { + return ComputeHash(Convertible.GetBytes(input)); + } + + /// + /// Computes the hash value for the specified . + /// + /// The to compute the hash code for. + /// A containing the computed hash code of the specified . + public abstract HashResult ComputeHash(byte[] input); + + /// + /// Computes the hash value for the specified . + /// + /// The to compute the hash code for. + /// A containing the computed hash code of the specified . + public virtual HashResult ComputeHash(Stream input) + { + return ComputeHash(Patterns.SafeInvoke(() => new MemoryStream(), destination => + { + Decorator.Enclose(input).CopyStream(destination); + return destination; + }).ToArray()); + } + + /// + /// Defines the initializer that must implement. + /// + /// An instance of the configured options. + protected abstract void EndianInitializer(EndianOptions options); +} + +/// +/// Configuration options for . +/// +public class FowlerNollVoOptions : ConvertibleOptions +{ + /// + /// Initializes a new instance of the class. + /// + /// + /// The following table shows the initial property values for an instance of . + /// + /// + /// Property + /// Initial Value + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + public FowlerNollVoOptions() + { + Algorithm = FowlerNollVoAlgorithm.Fnv1a; + ByteOrder = Endianness.BigEndian; + } + + /// + /// Gets or sets the algorithm of the Fowler-Noll-Vo hash function. + /// + /// The algorithm of the Fowler-Noll-Vo hash function. + public FowlerNollVoAlgorithm Algorithm { get; set; } +} +``` diff --git a/Directory.Packages.props b/Directory.Packages.props index be4d93d..904ca31 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -13,37 +13,37 @@ - - - + + + - - - - - + + + + + - + - - - - - - + + + + + + - - - - - - + + + + + + \ No newline at end of file From 86005380a68a3622cf7141a74e7221a091917aa1 Mon Sep 17 00:00:00 2001 From: gimlichael Date: Fri, 16 Oct 2026 12:49:58 +0200 Subject: [PATCH 3/4] updated changelog --- CHANGELOG.md | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3222231..aea0743 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,24 @@ For more details, please refer to `PackageReleaseNotes.txt` on a per assembly ba ## [12.0.2] - 2026-10-15 -This is a service update that focuses on package dependencies. +This is a patch release that updates package dependencies across all supported target frameworks and consolidates the agent guidance for this repository into `AGENTS.md`. + +### Changed + +- Upgraded Cuemon.Core, Cuemon.Extensions.AspNetCore, and Cuemon.Extensions.IO from 10.7.1 to 10.8.1, +- Upgraded Microsoft.NET.Test.Sdk from 18.10.1 to 18.11.0, +- Upgraded Codebelt.Coverlet.MTP from 10.0.1 to 10.1.0, +- Upgraded Microsoft.Testing.Extensions.HangDump from 2.4.1 to 2.5.1, +- Upgraded xunit.v3, xunit.v3.assert, xunit.v3.extensibility.core, and xunit.v3.runner.console from 4.0.1 to 4.0.2, +- Upgraded xunit.runner.visualstudio from 4.0.0 to 4.0.1, +- Upgraded Microsoft.Bcl.AsyncInterfaces from 10.0.12 to 10.0.13, +- Upgraded Microsoft.Extensions.Configuration, Microsoft.Extensions.Configuration.EnvironmentVariables, Microsoft.Extensions.Configuration.FileExtensions, Microsoft.Extensions.Configuration.Json, Microsoft.Extensions.Hosting, and Microsoft.AspNetCore.TestHost from 9.0.20 to 9.0.21 for .NET 9, +- Upgraded Microsoft.Extensions.Configuration, Microsoft.Extensions.Configuration.EnvironmentVariables, Microsoft.Extensions.Configuration.FileExtensions, Microsoft.Extensions.Configuration.Json, Microsoft.Extensions.Hosting, and Microsoft.AspNetCore.TestHost from 10.0.12 to 10.0.13 for .NET 10, +- `AGENTS.md` expanded with the unit test, performance test, and XML documentation writing guidelines previously held in `.github/copilot-instructions.md`. + +### Removed + +- `.github/copilot-instructions.md`, whose agent guidance is now maintained in `AGENTS.md`. ## [12.0.1] - 2026-09-11 @@ -551,7 +568,7 @@ This major release is first and foremost focused on ironing out any wrinkles tha -[Unreleased]: https://github.com/codebeltnet/xunit/compare/v12.0.1...HEAD +[12.0.2]: https://github.com/codebeltnet/xunit/compare/v12.0.1...v12.0.2 [12.0.1]: https://github.com/codebeltnet/xunit/compare/v12.0.0...v12.0.1 [12.0.0]: https://github.com/codebeltnet/xunit/compare/v11.2.1...v12.0.0 [11.2.1]: https://github.com/codebeltnet/xunit/compare/v11.2.0...v11.2.1 From bca85f73e9185b39ad755870aa34df2961f9b888 Mon Sep 17 00:00:00 2001 From: gimlichael Date: Fri, 16 Oct 2026 12:58:49 +0200 Subject: [PATCH 4/4] update agents.md --- AGENTS.md | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index f8ff3db..4fd549f 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -214,21 +214,17 @@ Refactoring always requires 100% unit test coverage of the functionality being r ### Test platform and coverage policy -- Microsoft.Testing.Platform is the test platform for this repository. -- `coverlet.MTP` is the selected MTP-native coverage engine. -- Pin `coverlet.MTP` to `8.0.1` for `net9.0` and `10.0.1` for `net10.0` and `net48` test targets. -- The `net9.0` test-only transitive `Microsoft.Extensions.Configuration` version required by Coverlet is `10.0.1`; keep the shared non-test `net9.0` pin at `9.0.20`. -- OpenCover is the canonical Codebelt coverage interchange format. -- `coverlet.collector` and `coverlet.msbuild` are legacy integrations and must not be added to MTP-based test projects. -- `Microsoft.Testing.Extensions.CodeCoverage` is not the selected coverage provider. -- MTP coverage is enabled for supported modern .NET targets and `net48`; other .NET Framework targets remain test-only unless verified. +- Microsoft.Testing.Platform is the test platform, selected by `test.runner` in `global.json`. +- `Codebelt.Coverlet.MTP` is the selected MTP-native coverage provider, referenced for all test projects in `Directory.Build.props`. +- OpenCover is the canonical Codebelt coverage interchange format; collect it with `--coverlet --coverlet-output-format opencover`. +- Do not add upstream `coverlet.MTP`, legacy `coverlet.collector` / `coverlet.msbuild`, or `Microsoft.Testing.Extensions.CodeCoverage` alongside the selected provider. - `Microsoft.Testing.Extensions.HangDump` provides MTP hang-dump diagnostics for the existing CI inputs. ## CI/Build Notes - Assembly signing uses `xunit.snk` (skip for external builds) - MinVer handles versioning based on Git tags -- MTP coverage uses `coverlet.MTP` and emits OpenCover under TestResults. +- MTP coverage uses `Codebelt.Coverlet.MTP` and emits OpenCover under TestResults through the reusable test workflow referenced in `.github/workflows/ci-pipeline.yml`. - SonarCloud and CodeQL analysis enabled ## Release Notes @@ -498,16 +494,6 @@ public class DateSpanTest : Test - Do not rely on external systems except for xUnit itself and Codebelt.Extensions.Xunit (and derived from this). - Ensure tests are deterministic and repeatable. -#### Microsoft Testing Platform coverage - -- Microsoft.Testing.Platform is the test platform for this repository. -- Use `coverlet.MTP` as the MTP-native coverage engine and OpenCover as the canonical Codebelt coverage format. -- Pin `coverlet.MTP` to `8.0.1` for `net9.0` and `10.0.1` for `net10.0` and `net48`; the test-only net9 `Microsoft.Extensions.Configuration` transitive pin is `10.0.1`, while the shared non-test net9 pin remains `9.0.20`. -- Do not add `coverlet.collector` or `coverlet.msbuild` to MTP-based test projects; they are legacy integrations. -- Do not add `Microsoft.Testing.Extensions.CodeCoverage` as the coverage provider. -- Keep MTP Coverlet coverage on supported modern .NET targets and `net48`; other .NET Framework targets remain test-only unless verified. -- Use `Microsoft.Testing.Extensions.HangDump` for the MTP hang-dump flags forwarded by CI. - ### 8. Test Doubles - Preferred test doubles include dummies, fakes, stubs and spies if and when the design allows it.