From 9b4a35c9a4eb53f70cc77d6644a36978c0664591 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 24 Mar 2026 12:02:03 +0000 Subject: [PATCH 1/5] Initial plan From 5b1f152523336c041d93cfd2f90e0cf823a78dc4 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 24 Mar 2026 12:08:34 +0000 Subject: [PATCH 2/5] Apply template updates from TemplateDotNetLibrary - Add contributor license agreement wording to README.md License section (aligns with TemplateDotNetLibrary PR #12) - Add MSTest V4 Best Practices section to AGENTS.md with antipatterns: MSTEST0058 (assertions in catch blocks), Assert.IsTrue for equality, collection count checks, prefix checks, and non-public test visibility (aligns with TemplateDotNetLibrary PRs #4 and #21) --- AGENTS.md | 87 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ README.md | 2 ++ 2 files changed, 89 insertions(+) diff --git a/AGENTS.md b/AGENTS.md index 544e37b..0690531 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -177,6 +177,93 @@ This repository follows continuous compliance practices from DEMA Consulting Con For detailed requirements format, test linkage patterns, and ReqStream integration, call the @requirements agent. +## MSTest Best Practices + +When writing or reviewing tests, follow these MSTest V4 best practices to avoid common antipatterns. + +### Antipatterns to Avoid + +#### MSTEST0058 — Assertions in Catch Blocks + +Do not place assertions in catch blocks. Use `Assert.ThrowsExactly()` instead: + +```csharp +// ❌ Bad: Assertion in catch block +try +{ + SomeMethod(); + Assert.Fail("Expected exception"); +} +catch (InvalidOperationException) +{ + // passes silently +} + +// ✅ Good: Use Assert.ThrowsExactly +Assert.ThrowsExactly(() => SomeMethod()); +``` + +#### Prefer Specific Assertions Over Assert.IsTrue/IsFalse + +Using `Assert.IsTrue`/`Assert.IsFalse` for equality checks produces poor failure messages. Use specific assertions: + +```csharp +// ❌ Bad: Poor failure message +Assert.IsTrue(result == 42); +Assert.IsFalse(result != 42); + +// ✅ Good: Rich failure message with expected/actual values +Assert.AreEqual(42, result); +Assert.AreNotEqual(0, result); +``` + +#### Use Assert.HasCount for Collections + +Do not use `Assert.IsTrue` for collection count checks: + +```csharp +// ❌ Bad: Poor failure message +Assert.IsTrue(collection.Count == 3); + +// ✅ Good: Rich failure message +Assert.HasCount(3, collection); +``` + +#### Use Assert.StartsWith for Prefix Checks + +Do not use `Assert.IsTrue(value.StartsWith(...))` — use the dedicated assertion: + +```csharp +// ❌ Bad: Poor failure message +Assert.IsTrue(value.StartsWith("prefix")); + +// ✅ Good: Rich failure message showing expected prefix and actual value +Assert.StartsWith("prefix", value); +``` + +#### Non-Public Test Classes and Methods Are Silently Ignored + +MSTest silently ignores non-public test classes and test methods — no warning or error is produced: + +```csharp +// ❌ Bad: Silently ignored by the test runner +class MyTests // missing public modifier +{ + [TestMethod] + void TestSomething() // missing public modifier + { } +} + +// ✅ Good: Properly visible to the test runner +[TestClass] +public class MyTests +{ + [TestMethod] + public void TestSomething() + { } +} +``` + ## Agent Report Files When agents need to write report files to communicate with each other or the user, follow these guidelines: diff --git a/README.md b/README.md index b301ffa..26ecfb1 100644 --- a/README.md +++ b/README.md @@ -273,6 +273,8 @@ We welcome contributions! Please see our [Contributing Guide][contributing] for This project is licensed under the MIT License - see the [LICENSE][link-license] file for details. +By contributing to this project, you agree that your contributions will be licensed under the MIT License. + ## Support - 📝 [Report a Bug](https://github.com/demaconsulting/TestResults/issues/new?labels=bug) From 7458775669e30de407c0f4e382cc34f065ad6189 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 24 Mar 2026 12:12:54 +0000 Subject: [PATCH 3/5] Fix linting issues: add 'antipatterns' to cspell dictionary, fix YAML comment indentation - Add 'antipatterns' to .cspell.yaml words list (technical term used in AGENTS.md) - Move TODO comments in reqstream OTS YAML files to be above their sequence items rather than inside them, to avoid yamllint comment-indentation warnings (docs/reqstream/ots-sonarscanner.yaml, ots-weasyprinttool.yaml, ots-pandoctool.yaml) --- .cspell.yaml | 1 + docs/reqstream/ots-pandoctool.yaml | 2 +- docs/reqstream/ots-sonarscanner.yaml | 2 +- docs/reqstream/ots-weasyprinttool.yaml | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.cspell.yaml b/.cspell.yaml index 8fdf9fa..8748f93 100644 --- a/.cspell.yaml +++ b/.cspell.yaml @@ -14,6 +14,7 @@ language: en # Project-specific technical terms and tool names words: + - antipatterns - Anson - Blockquotes - buildmark diff --git a/docs/reqstream/ots-pandoctool.yaml b/docs/reqstream/ots-pandoctool.yaml index da9aec2..551beb0 100644 --- a/docs/reqstream/ots-pandoctool.yaml +++ b/docs/reqstream/ots-pandoctool.yaml @@ -10,8 +10,8 @@ sections: - title: OTS Software Requirements sections: + # TODO: Add requirement when demaconsulting.pandoctool supports --validate - title: PandocTool Requirements - # TODO: Add requirement when demaconsulting.pandoctool supports --validate # requirements: # - id: TestResults-OTS-PandocTool # title: PandocTool shall convert markdown documentation to HTML for PDF generation. diff --git a/docs/reqstream/ots-sonarscanner.yaml b/docs/reqstream/ots-sonarscanner.yaml index 422ba97..271547e 100644 --- a/docs/reqstream/ots-sonarscanner.yaml +++ b/docs/reqstream/ots-sonarscanner.yaml @@ -10,8 +10,8 @@ sections: - title: OTS Software Requirements sections: + # TODO: Add requirement when dotnet-sonarscanner supports --validate - title: SonarScanner Requirements - # TODO: Add requirement when dotnet-sonarscanner supports --validate # requirements: # - id: TestResults-OTS-SonarScanner # title: SonarScanner shall upload code analysis results to SonarCloud. diff --git a/docs/reqstream/ots-weasyprinttool.yaml b/docs/reqstream/ots-weasyprinttool.yaml index f053b9b..bfc104b 100644 --- a/docs/reqstream/ots-weasyprinttool.yaml +++ b/docs/reqstream/ots-weasyprinttool.yaml @@ -10,8 +10,8 @@ sections: - title: OTS Software Requirements sections: + # TODO: Add requirement when demaconsulting.weasyprinttool supports --validate - title: WeasyPrintTool Requirements - # TODO: Add requirement when demaconsulting.weasyprinttool supports --validate # requirements: # - id: TestResults-OTS-WeasyPrintTool # title: WeasyPrintTool shall convert HTML documentation to PDF release artifacts. From 385fa1215abf71469fabccb1f893fbe02bd05f5f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 24 Mar 2026 12:31:02 +0000 Subject: [PATCH 4/5] Align agent tools YAML frontmatter with TemplateDotNetLibrary template Apply template changes from PRs #61 and #64: - code-quality: add 'agent' tool - code-review: add 'edit' and 'web' tools - repo-consistency: add 'execute' tool - requirements: add 'github', 'web', and 'agent' tools - software-developer: add 'agent' tool - technical-writer: add 'github' and 'agent' tools - test-developer: add 'github' and 'agent' tools All agent tools lists now normalized to canonical order: [read, search, edit, execute, github, (web,) agent] --- .github/agents/code-quality.agent.md | 2 +- .github/agents/code-review.agent.md | 2 +- .github/agents/repo-consistency.agent.md | 2 +- .github/agents/requirements.agent.md | 2 +- .github/agents/software-developer.agent.md | 2 +- .github/agents/technical-writer.agent.md | 2 +- .github/agents/test-developer.agent.md | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/agents/code-quality.agent.md b/.github/agents/code-quality.agent.md index 37100ee..4ce302e 100644 --- a/.github/agents/code-quality.agent.md +++ b/.github/agents/code-quality.agent.md @@ -1,7 +1,7 @@ --- name: code-quality description: Ensures code quality through comprehensive linting and static analysis. -tools: [edit, read, search, execute, github] +tools: [read, search, edit, execute, github, agent] user-invocable: true --- diff --git a/.github/agents/code-review.agent.md b/.github/agents/code-review.agent.md index 6ef6289..fb01a20 100644 --- a/.github/agents/code-review.agent.md +++ b/.github/agents/code-review.agent.md @@ -1,7 +1,7 @@ --- name: code-review description: Assists in performing formal file reviews. -tools: [read, search, github, agent, execute] +tools: [read, search, edit, execute, github, web, agent] user-invocable: true --- diff --git a/.github/agents/repo-consistency.agent.md b/.github/agents/repo-consistency.agent.md index ef5d296..b2ef033 100644 --- a/.github/agents/repo-consistency.agent.md +++ b/.github/agents/repo-consistency.agent.md @@ -1,7 +1,7 @@ --- name: repo-consistency description: Ensures downstream repositories remain consistent with the TemplateDotNetLibrary template patterns and best practices. -tools: [edit, read, search, github, agent] +tools: [read, search, edit, execute, github, agent] user-invocable: true --- diff --git a/.github/agents/requirements.agent.md b/.github/agents/requirements.agent.md index 8d7cc56..3e41722 100644 --- a/.github/agents/requirements.agent.md +++ b/.github/agents/requirements.agent.md @@ -1,7 +1,7 @@ --- name: requirements description: Develops requirements and ensures appropriate test coverage. -tools: [edit, read, search, execute] +tools: [read, search, edit, execute, github, web, agent] user-invocable: true --- diff --git a/.github/agents/software-developer.agent.md b/.github/agents/software-developer.agent.md index ceed8d4..7c46ec9 100644 --- a/.github/agents/software-developer.agent.md +++ b/.github/agents/software-developer.agent.md @@ -1,7 +1,7 @@ --- name: software-developer description: Writes production code and self-validation tests. -tools: [edit, read, search, execute, github] +tools: [read, search, edit, execute, github, agent] user-invocable: true --- diff --git a/.github/agents/technical-writer.agent.md b/.github/agents/technical-writer.agent.md index fa95e6c..b0801fc 100644 --- a/.github/agents/technical-writer.agent.md +++ b/.github/agents/technical-writer.agent.md @@ -1,7 +1,7 @@ --- name: technical-writer description: Ensures documentation is accurate and complete. -tools: [edit, read, search, execute] +tools: [read, search, edit, execute, github, agent] user-invocable: true --- diff --git a/.github/agents/test-developer.agent.md b/.github/agents/test-developer.agent.md index 4e6130e..d8bd877 100644 --- a/.github/agents/test-developer.agent.md +++ b/.github/agents/test-developer.agent.md @@ -1,7 +1,7 @@ --- name: test-developer description: Writes unit and integration tests. -tools: [edit, read, search, execute] +tools: [read, search, edit, execute, github, agent] user-invocable: true --- From a5d192e7af5aeb18f19e3f81c28f4a627d25906d Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 24 Mar 2026 12:45:21 +0000 Subject: [PATCH 5/5] chore: fix repo-consistency agent to fetch most recently merged PRs (PR #65) Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com> Agent-Logs-Url: https://github.com/demaconsulting/TestResults/sessions/e3b945f5-6681-4166-84e4-ea82d0d9f1de --- .github/agents/repo-consistency.agent.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/agents/repo-consistency.agent.md b/.github/agents/repo-consistency.agent.md index b2ef033..b4fa45b 100644 --- a/.github/agents/repo-consistency.agent.md +++ b/.github/agents/repo-consistency.agent.md @@ -18,7 +18,7 @@ consistency gaps, template evolution updates, and recommended changes for the sp ## Consistency Steps -1. Fetch the last 20 merged PRs (`is:pr is:merged`) from +1. Fetch the 20 most recently merged PRs (`is:pr is:merged sort:updated-desc`) from 2. Determine the intent of the template pull requests (what changes were performed to which files) 3. Apply missing changes to this repository's files (if appropriate and with translation)