From eeda922f07ef68343dccfa867bc80def06aae1c3 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 1 Mar 2026 01:11:06 +0000 Subject: [PATCH 1/2] Initial plan From c53f897b2a849c494dbaa581dbb22f3648ab06c8 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 1 Mar 2026 01:33:32 +0000 Subject: [PATCH 2/2] chore: sync VHDLTest with TemplateDotNetTool template updates Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com> --- .github/agents/test-developer.md | 60 +++++++++++++++++++ src/DEMAConsulting.VHDLTest/Context.cs | 3 + .../DEMAConsulting.VHDLTest.csproj | 24 ++++++-- src/DEMAConsulting.VHDLTest/Validation.cs | 3 + .../DEMAConsulting.VHDLTest.Tests.csproj | 22 ++++--- 5 files changed, 99 insertions(+), 13 deletions(-) diff --git a/.github/agents/test-developer.md b/.github/agents/test-developer.md index 5ee3a73..8084e0c 100644 --- a/.github/agents/test-developer.md +++ b/.github/agents/test-developer.md @@ -64,6 +64,22 @@ public void ClassName_MethodUnderTest_Scenario_ExpectedBehavior() - Failure-testing and error handling scenarios - Verifying internal behavior beyond requirement scope +### Test Source Filters + +Test links in `requirements.yaml` can include a source filter prefix to restrict which test results count as +evidence. These filters are critical for platform, simulator, and framework requirements - **do not remove them**. + +- `ghdl@TestName` - proves the test passed using the GHDL simulator +- `nvc@TestName` - proves the test passed using the NVC simulator +- `windows@TestName` - proves the test passed on a Windows platform +- `ubuntu@TestName` - proves the test passed on a Linux (Ubuntu) platform +- `dotnet8.x@TestName` - proves the self-validation test ran on a machine with .NET 8.x runtime +- `dotnet9.x@TestName` - proves the self-validation test ran on a machine with .NET 9.x runtime +- `dotnet10.x@TestName` - proves the self-validation test ran on a machine with .NET 10.x runtime + +Removing a source filter means a test result from any environment can satisfy the requirement, which invalidates +the evidence-based proof that the tool works on a specific platform, simulator, or framework. + ### VHDLTest-Specific - **NOT self-validation tests** - those are handled by Software Developer Agent @@ -71,6 +87,50 @@ public void ClassName_MethodUnderTest_Scenario_ExpectedBehavior() - Use MSTest V4 testing framework - Follow existing naming conventions in the test suite +### MSTest V4 Best Practices + +Common anti-patterns to avoid (not exhaustive): + +1. **Avoid Assertions in Catch Blocks (MSTEST0058)** - Instead of wrapping code in try/catch and asserting in the + catch block, use `Assert.ThrowsExactly()`: + + ```csharp + var ex = Assert.ThrowsExactly(() => SomeWork()); + Assert.Contains("Some message", ex.Message); + ``` + +2. **Avoid using Assert.IsTrue / Assert.IsFalse for equality checks** - Use `Assert.AreEqual` / + `Assert.AreNotEqual` instead, as it provides better failure messages: + + ```csharp + // ❌ Bad: Assert.IsTrue(result == expected); + // ✅ Good: Assert.AreEqual(expected, result); + ``` + +3. **Avoid non-public test classes and methods** - Test classes and `[TestMethod]` methods must be `public` or + they will be silently ignored: + + ```csharp + // ❌ Bad: internal class MyTests + // ✅ Good: public class MyTests + ``` + +4. **Avoid Assert.IsTrue(collection.Count == N)** - Use `Assert.HasCount` for count assertions: + + ```csharp + // ❌ Bad: Assert.IsTrue(collection.Count == 3); + // ✅ Good: Assert.HasCount(3, collection); + ``` + +5. **Avoid Assert.IsTrue for string prefix checks** - Use `Assert.StartsWith` instead of wrapping + `string.StartsWith` in `Assert.IsTrue`, as it produces clearer failure messages that show the expected prefix + and actual value: + + ```csharp + // ❌ Bad: Assert.IsTrue(value.StartsWith("prefix")); + // ✅ Good: Assert.StartsWith("prefix", value); + ``` + ## Defer To - **Requirements Agent**: For test strategy and coverage requirements diff --git a/src/DEMAConsulting.VHDLTest/Context.cs b/src/DEMAConsulting.VHDLTest/Context.cs index 1b00f2d..7257577 100644 --- a/src/DEMAConsulting.VHDLTest/Context.cs +++ b/src/DEMAConsulting.VHDLTest/Context.cs @@ -196,6 +196,9 @@ public void WriteError(string? message) /// On invalid arguments public static Context Create(string[] args) { + // Validate input + ArgumentNullException.ThrowIfNull(args); + // Process the arguments var help = false; var version = false; diff --git a/src/DEMAConsulting.VHDLTest/DEMAConsulting.VHDLTest.csproj b/src/DEMAConsulting.VHDLTest/DEMAConsulting.VHDLTest.csproj index acf1ae1..b8dd3bd 100644 --- a/src/DEMAConsulting.VHDLTest/DEMAConsulting.VHDLTest.csproj +++ b/src/DEMAConsulting.VHDLTest/DEMAConsulting.VHDLTest.csproj @@ -3,12 +3,12 @@ Exe net8.0;net9.0;net10.0 - 12 + latest enable enable - True + true vhdltest DemaConsulting.VHDLTest 0.0.0 @@ -26,7 +26,7 @@ DemaConsulting.VHDLTest - True + true snupkg true true @@ -34,7 +34,7 @@ true - True + true true true latest @@ -48,14 +48,26 @@ - + + + all runtime; build; native; contentfiles; analyzers; buildtransitive - + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/src/DEMAConsulting.VHDLTest/Validation.cs b/src/DEMAConsulting.VHDLTest/Validation.cs index 1ce65ed..66a6efc 100644 --- a/src/DEMAConsulting.VHDLTest/Validation.cs +++ b/src/DEMAConsulting.VHDLTest/Validation.cs @@ -41,6 +41,9 @@ public static class Validation /// Program context public static void Run(Context context) { + // Validate input + ArgumentNullException.ThrowIfNull(context); + // Write validation header context.WriteLine( $""" diff --git a/test/DEMAConsulting.VHDLTest.Tests/DEMAConsulting.VHDLTest.Tests.csproj b/test/DEMAConsulting.VHDLTest.Tests/DEMAConsulting.VHDLTest.Tests.csproj index fee58ab..87a81cb 100644 --- a/test/DEMAConsulting.VHDLTest.Tests/DEMAConsulting.VHDLTest.Tests.csproj +++ b/test/DEMAConsulting.VHDLTest.Tests/DEMAConsulting.VHDLTest.Tests.csproj @@ -11,30 +11,42 @@ true - True + true true true latest + + + + + + + all runtime; build; native; contentfiles; analyzers; buildtransitive - + + + + + all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers; buildtransitive + True @@ -42,8 +54,4 @@ - - - -