Skip to content

Conversation

@ignatandrei
Copy link
Owner

@ignatandrei ignatandrei commented Nov 28, 2025

Summary by CodeRabbit

  • New Features

    • Added TUnit as the 239th RSCG example—a modern .NET testing framework featuring compile-time test discovery, parallel execution, Native AOT support, and advanced test orchestration.
  • Documentation

    • Added comprehensive guides, code examples, and interactive tours for TUnit integration and usage.
  • Chores

    • Updated all documentation to reflect 239 total RSCG examples.

✏️ Tip: You can customize this high-level summary in your review settings.

Added a new example for TUnit (RSCG #239), including TUnit.html, a corresponding entry in the list and YAML, and a downloadable source zip. Updated the documentation to use the correct banner image URL and incremented the RSCG count. Also updated the RSCG.xlsx export.
Copilot AI review requested due to automatic review settings November 28, 2025 17:47
@ignatandrei ignatandrei linked an issue Nov 28, 2025 that may be closed by this pull request
@coderabbitai
Copy link

coderabbitai bot commented Nov 28, 2025

Walkthrough

This PR adds TUnit as the 239th RSCG example. It includes new test project files, comprehensive documentation pages, updated metadata across the example registry, and incremented the total example count from 238 to 239 throughout the documentation site and configuration files.

Changes

Cohort / File(s) Change Summary
Root documentation updates
README.md, later.md
Updated RSCG count from 238 to 239; incremented date from 2025-11-07 to 2025-11-08; added TUnit entry with full metadata and details.
Generator configuration and metadata
v2/Generator/MultiGeneratorV2.cs, v2/RSCGExamplesData/GeneratorDataRec.json
Added banner asset path replacement rule in GrabReadMe; appended new TUnit entry to generator data with ID, category 13 (Tests), and start date 2025-11-08.
Example source files (TUnit)
v2/rscg_examples/TUnit/*
Added new TUnit example directory with project file (TestDemo.csproj), test file (FirstTest.cs), solution file (TestDemo.slnx), description metadata (description.json), extended documentation (readme.txt), and video tour script (video.json).
Static documentation pages
v2/book/examples/TUnit.html, v2/book/list.html, v2/book/pandocHTML.yaml
Created TUnit HTML documentation page with overview, usage guide, and generated code references; added TUnit row to examples list; included new input file in Pandoc configuration.
Codetour and interactive content
v2/.tours/TUnit.tour
Added codetour JSON defining guided walkthrough steps for TUnit example (csproj modification, test file demonstration, generated file references).
Documentation site updates (Categories and Examples)
v2/rscg_examples_site/docs/Categories/Tests.md, v2/rscg_examples_site/docs/Categories/_PrimitiveTests.mdx, v2/rscg_examples_site/docs/RSCG-Examples/TUnit.md, v2/rscg_examples_site/docs/RSCG-Examples/index.md, v2/rscg_examples_site/docs/indexRSCG.md, v2/rscg_examples_site/docs/about.md
Updated Tests category count from 5 to 6; added TUnit entries to category lists and main index; created comprehensive TUnit documentation page; incremented RSCG total from 238 to 239 across all pages.
Site metadata and UI
v2/rscg_examples_site/src/components/HomepageFeatures/index.js, v2/rscg_examples_site/static/exports/RSCG.json
Updated feature title count from 238 to 239; added TUnit entry to public RSCG export catalog with name, links, category, and added date.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~35 minutes

  • Verify consistency of all "238 → 239" count updates across diverse file types (MD, JSON, JS, HTML)
  • Validate JSON structure in GeneratorDataRec.json and RSCG.json for proper formatting and key integrity
  • Check internal documentation links (e.g., /docs/TUnit, examples/TUnit.html) for correctness
  • Confirm C# test code in FirstTest.cs and project configuration in TestDemo.csproj follow established conventions
  • Review video.json structure for the potential "SpeakTest" field anomaly noted in the generator analysis

Possibly related PRs

  • vyaml #408: Adds a new RSCG example and updates v2/Generator/MultiGeneratorV2.cs to extend README asset-replacement logic, following the same pattern as this PR.
  • first iteration #405: Adds a new RSCG example with generator metadata (GeneratorDataRec.json) and modifies MultiGeneratorV2.cs for path rewrites.
  • adding program #422: Modifies v2/Generator/MultiGeneratorV2.cs GrabReadMe function to add banner asset path replacements, directly related to the generator changes in this PR.

Poem

🐰 A 239th Hop of Joy

A new test friend joins our warren so bright,
TUnit the hopper, example of might!
From 238 burrows we've tunneled with care,
Now 239 wonders are waiting out there—
With tests that compile and code that runs true,
thump thump 🐾 our collection grew!

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Title check ❓ Inconclusive The title 'added tunit' is vague and uses generic phrasing that doesn't convey meaningful information about the extensive changeset. Use a more descriptive title like 'Add TUnit as 239th RSCG example with documentation and tour' to clearly convey the main change.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch 424-tunit

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copilot finished reviewing on behalf of ignatandrei November 28, 2025 17:50
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (6)
v2/Generator/MultiGeneratorV2.cs (1)

121-133: New (assets/banner.) rewrite is consistent and safe

The added replacement

text = text.Replace("(assets/banner.", $"({d.Generator!.Source}/assets/banner.");

is consistent with the surrounding logic: it correctly rewrites a relative README asset path to an absolute one rooted at Generator.Source, and nullability is guarded earlier by the string.IsNullOrWhiteSpace(source) check, so the ! is safe here.

If you keep adding more of these special-case rewrites over time, you might eventually want to centralize them into a data‑driven map (e.g., a list of (from, toTemplate) pairs) to reduce repetition and make future additions easier, but this is purely optional for this PR.

v2/rscg_examples_site/docs/indexRSCG.md (1)

10-13: Top-level 239 count and TUnit row look correct; minor markdown nit

The heading/intro correctly reference 239 examples, and the new TUnit row (no. 239) matches the table format and category links.

There is a tiny markdownlint issue: the link text has a trailing space ([TUnit by Tom Longhurst ]). If you want to satisfy MD039, you can drop the internal space:

-|239| [TUnit by Tom Longhurst ](/docs/TUnit)|2025-11-08 => 08 November 2025 | [Tests](/docs/Categories/Tests) |
+|239| [TUnit by Tom Longhurst](/docs/TUnit)|2025-11-08 => 08 November 2025 | [Tests](/docs/Categories/Tests) |

Also applies to: 23-23

v2/.tours/TUnit.tour (1)

5-44: Double‑check pattern for the FirstTest.cs step

The pattern value "this is the code" in the FirstTest.cs step may not actually occur in that file, which can prevent CodeTour from positioning on the intended code. Consider using something stable from the file (e.g., the test method name or [Test] attribute) so the step reliably focuses the right area.

v2/book/examples/TUnit.html (1)

23-52: Add alt text for images to improve accessibility

All the screenshots (TestDemo.csproj.png, FirstTest.cs.png, and the generated *.g.cs images) use <img> without alt. Adding short descriptive alt text for each will help screen‑reader users without changing layout.

v2/rscg_examples_site/docs/RSCG-Examples/TUnit.md (2)

255-273: Fix escaped braces in C# code blocks so examples are valid

Within fenced ```csharp blocks, several braces are escaped as \{, which will render literally and make the sample code invalid C#. Since fenced code is treated as plain text in MDX, you don’t need those escapes. Removing the backslashes will improve copy‑paste‑ability of the examples.

Here’s a focused diff for the affected snippets:

-    public WindowsOnlyAttribute() : base("Windows only test") \{ }
+    public WindowsOnlyAttribute() : base("Windows only test") { }
@@
-    public RetryOnHttpErrorAttribute(int times) : base(times) \{ }
+    public RetryOnHttpErrorAttribute(int times) : base(times) { }
@@
-        => Task.FromResult(exception is HttpRequestException \{ StatusCode: HttpStatusCode.ServiceUnavailable });
+        => Task.FromResult(exception is HttpRequestException { StatusCode: HttpStatusCode.ServiceUnavailable });
@@
-public async Task Modern_TUnit_Test(string value) \{ }
+public async Task Modern_TUnit_Test(string value) { }
@@
-                        Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestDemo", static () => new global::TUnit.Core.AssemblyMetadata \{ Name = "TestDemo" }),
+                        Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestDemo", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestDemo" }),

Also applies to: 390-398, 743-744


34-41: Optional: address markdownlint warnings (bare URLs, code‑fence languages, tabs, alt text)

If you run markdownlint on this MDX file, it flags a few stylistic issues that are easy to tidy up:

  • Lines 34–41, 37, 39, 808: wrap bare URLs in Markdown links (e.g., [https://github.com/...](https://github.com/...)) to satisfy MD034 and improve consistency.
  • Line 52: the image in “Original Readme” has empty alt text – consider ![TUnit banner](...) to fix MD045 and aid accessibility.
  • Benchmark sections around the various BenchmarkDotNet blocks (e.g., near lines 424, 445, 467, 489, 511, 533): add an explicit language like ```text so those fences aren’t treated as heading/content by the linter (MD040/MD058).
  • Lines 589–592: replace hard tabs in the <PropertyGroup> block with spaces to align with the rest of the file and avoid MD010.

These are non‑functional, but cleaning them up will keep docs and linting output tidy.

Also applies to: 52-53, 424-485, 511-529, 533-551, 589-592, 808-808

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 54e5188 and f75fddb.

⛔ Files ignored due to path filters (3)
  • v2/Generator/all.csv is excluded by !**/*.csv
  • v2/rscg_examples_site/static/exports/RSCG.xlsx is excluded by !**/*.xlsx
  • v2/rscg_examples_site/static/sources/TUnit.zip is excluded by !**/*.zip
📒 Files selected for processing (22)
  • README.md (2 hunks)
  • later.md (1 hunks)
  • v2/.tours/TUnit.tour (1 hunks)
  • v2/Generator/MultiGeneratorV2.cs (1 hunks)
  • v2/RSCGExamplesData/GeneratorDataRec.json (1 hunks)
  • v2/book/examples/TUnit.html (1 hunks)
  • v2/book/list.html (2 hunks)
  • v2/book/pandocHTML.yaml (1 hunks)
  • v2/rscg_examples/TUnit/description.json (1 hunks)
  • v2/rscg_examples/TUnit/readme.txt (1 hunks)
  • v2/rscg_examples/TUnit/src/TestDemo.slnx (1 hunks)
  • v2/rscg_examples/TUnit/src/TestDemo/FirstTest.cs (1 hunks)
  • v2/rscg_examples/TUnit/src/TestDemo/TestDemo.csproj (1 hunks)
  • v2/rscg_examples/TUnit/video.json (1 hunks)
  • v2/rscg_examples_site/docs/Categories/Tests.md (2 hunks)
  • v2/rscg_examples_site/docs/Categories/_PrimitiveTests.mdx (1 hunks)
  • v2/rscg_examples_site/docs/RSCG-Examples/TUnit.md (1 hunks)
  • v2/rscg_examples_site/docs/RSCG-Examples/index.md (4 hunks)
  • v2/rscg_examples_site/docs/about.md (1 hunks)
  • v2/rscg_examples_site/docs/indexRSCG.md (2 hunks)
  • v2/rscg_examples_site/src/components/HomepageFeatures/index.js (1 hunks)
  • v2/rscg_examples_site/static/exports/RSCG.json (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
v2/Generator/MultiGeneratorV2.cs (1)
v2/Generator/Generator.cs (1)
  • Generator (4-145)
🪛 Biome (2.1.2)
v2/rscg_examples/TUnit/video.json

[error] 35-36: Property key must be double quoted

(parse)


[error] 36-36: unexpected character =

(parse)


[error] 36-36: expected , but instead found " "

Remove " "

(parse)


[error] 36-36: expected : but instead found }

Remove }

(parse)


[error] 37-38: Expected an array, an object, or a literal but instead found ']'.

Expected an array, an object, or a literal here.

(parse)

🪛 LanguageTool
v2/rscg_examples_site/docs/Categories/_PrimitiveTests.mdx

[style] ~13-~13: Using many exclamation marks might seem excessive (in this case: 12 exclamation marks for a text that’s 1480 characters long)
Context: ...) 2023-04-16 6 TUnit Nuget ![GitHub Repo stars](https://img.shields....

(EN_EXCESSIVE_EXCLAMATION)

v2/rscg_examples_site/docs/RSCG-Examples/index.md

[grammar] ~1449-~1449: Ensure spelling is correct
Context: ... MockMe TUnit

## Validator
Exp...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)

🪛 markdownlint-cli2 (0.18.1)
v2/rscg_examples_site/docs/indexRSCG.md

23-23: Spaces inside link text

(MD039, no-space-in-links)

v2/rscg_examples_site/docs/RSCG-Examples/TUnit.md

34-34: Bare URL used

(MD034, no-bare-urls)


37-37: Bare URL used

(MD034, no-bare-urls)


39-39: Bare URL used

(MD034, no-bare-urls)


52-52: Images should have alternate text (alt text)

(MD045, no-alt-text)


424-424: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


435-435: Tables should be surrounded by blank lines

(MD058, blanks-around-tables)


445-445: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


456-456: Tables should be surrounded by blank lines

(MD058, blanks-around-tables)


467-467: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


478-478: Tables should be surrounded by blank lines

(MD058, blanks-around-tables)


489-489: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


500-500: Tables should be surrounded by blank lines

(MD058, blanks-around-tables)


511-511: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


522-522: Tables should be surrounded by blank lines

(MD058, blanks-around-tables)


533-533: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


544-544: Tables should be surrounded by blank lines

(MD058, blanks-around-tables)


589-589: Hard tabs
Column: 1

(MD010, no-hard-tabs)


590-590: Hard tabs
Column: 1

(MD010, no-hard-tabs)


591-591: Hard tabs
Column: 1

(MD010, no-hard-tabs)


592-592: Hard tabs
Column: 1

(MD010, no-hard-tabs)


653-653: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


681-681: No space after hash on atx style heading

(MD018, no-missing-space-atx)


684-684: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


794-794: Spaces inside link text

(MD039, no-space-in-links)


808-808: Bare URL used

(MD034, no-bare-urls)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Agent
  • GitHub Check: CodeQL analysis (csharp)
  • GitHub Check: CodeQL analysis (javascript-typescript)
  • GitHub Check: call-workflow-passing-data / build (24.3.0)
🔇 Additional comments (15)
later.md (1)

3-3: Latest update date bump is consistent

The new “Latest Update : 2025-11-08 => 08 November 2025” line aligns with the TUnit example’s start date and overall PR timeline. No issues.

v2/book/pandocHTML.yaml (1)

255-255: TUnit HTML page correctly added to Pandoc inputs

Including examples/TUnit.html in input-files keeps the example list in sync with the new generator and ensures it participates in the book build.

v2/RSCGExamplesData/GeneratorDataRec.json (1)

1444-1450: TUnit generator entry is consistent and JSON-valid

The new TUnit record (Category 13, dtStart 2025-11-08, show: true) fits the existing Tests category and chronological ordering, and the added comma after TeCLI keeps the JSON structure valid.

v2/rscg_examples_site/docs/Categories/_PrimitiveTests.mdx (1)

13-13: TUnit entry added cleanly to Tests category

The new TUnit row (item 6) matches the existing formatting, numbering, and date conventions and points to the correct docs/nuget/github locations.

v2/rscg_examples/TUnit/src/TestDemo/TestDemo.csproj (1)

1-17: Project setup for the TUnit demo looks correct

net10.0 + OutputType Exe, implicit usings, nullable, and EmitCompilerGeneratedFiles into GX all match the typical pattern for these RSCG samples, and the TUnit package reference is wired in cleanly. Just ensure your dev/CI environment has the .NET 10 SDK and that TUnit version 1.2.11 is the intended one to showcase.

v2/rscg_examples/TUnit/src/TestDemo.slnx (1)

1-3: Solution file correctly references the demo project

The .slnx solution cleanly includes the TestDemo/TestDemo.csproj via a relative path; no extra configuration needed for this example.

v2/rscg_examples/TUnit/description.json (1)

1-22: TUnit description metadata is well-formed and consistent

The JSON structure (generator/data/links) is valid, points to the correct demo project and source file, and aligns with the conventions used for other generators in this repository.

v2/rscg_examples_site/docs/Categories/Tests.md (1)

3-15: Tests category count and TUnit entry look consistent

The Tests category count is correctly updated to 6 and the new TUnit row matches the existing formatting and badge/link conventions.

v2/book/list.html (1)

20-21: Header count and new TUnit row are aligned

The header now reflects 239 items, and the appended row 239 for TUnit follows the existing table structure and link pattern.

Also applies to: 981-984

v2/rscg_examples_site/docs/about.md (1)

8-10: Updated total to 239 is consistent

The about text now references 239 RSCG, which matches the rest of the site updates for TUnit.

v2/rscg_examples_site/static/exports/RSCG.json (1)

1908-1916: New TUnit entry in export catalog is well-formed

The TUnit object matches the schema of other items (Name/Link/NuGet/Source/Category/AddedOn) and keeps the JSON structure valid.

v2/rscg_examples_site/docs/RSCG-Examples/index.md (1)

3-4: RSCG count and Tests category wiring for TUnit are coherent

Title/description, Tests example count, the added TUnit link, and the mermaid Tests--> TUnit edge are all in sync with the new example and mirror the structure used for other categories.

Also applies to: 1420-1450, 1961-1961

v2/rscg_examples_site/src/components/HomepageFeatures/index.js (1)

7-7: Homepage total updated to 239 matches the catalog

The feature title now reflects 239 examples while keeping the “15 from MSFT” detail; no structural changes to the component.

v2/rscg_examples/TUnit/readme.txt (1)

1-500: TUnit readme content looks consistent and well‑structured

This readme cleanly embeds the upstream TUnit documentation (features, examples, benchmarks) without introducing obvious formatting or syntax issues. Nothing blocking here from a docs perspective.

README.md (1)

1-49: README metadata and TUnit catalog entry look consistent

The example count (239), latest‑update date, and the new “239. TUnit” block are all aligned and follow the existing formatting and ordering of the catalog. Links and category classification (Tests) also look correct.

Comment on lines +4 to +12
public class FirstTest
{
[Test]
public async Task Add_WithTwoNumbers_ReturnsSum()
{
var result = true;
// Assert
await Assert.That(result).IsTrue();
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Find the test file and verify its existence and content
fd -t f "FirstTest.cs" -x cat -n {}

Repository: ignatandrei/RSCG_Examples

Length of output: 375


🏁 Script executed:

#!/bin/bash
# Search for TUnit test patterns in the repository to validate assertion methods
fd -t f "*.cs" -path "*/TUnit/*" | head -20

Repository: ignatandrei/RSCG_Examples

Length of output: 237


🏁 Script executed:

#!/bin/bash
# Find C# test files in TUnit directory
find . -path "*/TUnit/*" -name "*.cs" -type f | head -20

Repository: ignatandrei/RSCG_Examples

Length of output: 119


🏁 Script executed:

#!/bin/bash
# Search for IsEqualTo usage and TUnit Assert patterns in the repository
rg "IsEqualTo" -t cs --max-count 20

Repository: ignatandrei/RSCG_Examples

Length of output: 51


🏁 Script executed:

#!/bin/bash
# Search for Assert patterns in the repository
rg "Assert\." -t cs --max-count 20

Repository: ignatandrei/RSCG_Examples

Length of output: 1294


🏁 Script executed:

#!/bin/bash
# Look for TUnit project files, documentation, or references
find . -path "*/TUnit/*" \( -name "*.csproj" -o -name "*.md" -o -name "*.txt" -o -name "*.json" \)

Repository: ignatandrei/RSCG_Examples

Length of output: 236


🏁 Script executed:

#!/bin/bash
# Check the TUnit project file for package references
cat -n ./v2/rscg_examples/TUnit/src/TestDemo/TestDemo.csproj

Repository: ignatandrei/RSCG_Examples

Length of output: 726


🌐 Web query:

TUnit 1.2.11 assertion methods IsEqualTo documentation

💡 Result:

IsEqualTo — brief summary (TUnit 1.2.11)

  • Purpose: assert that an actual value equals an expected value using TUnit's fluent, awaitable assertions. [1]
  • Usage (async): await Assert.That(actual).IsEqualTo(expected);. Assertions must be awaited. [1][2]
  • Numeric/floating options: supports a tolerance parameter for approximate comparisons (e.g., IsEqualTo(Math.PI, tolerance: 0.001)). [1]
  • Common patterns:
    • Basic equality: await Assert.That(result).IsEqualTo(5). [1][2]
    • With tolerance for floats/doubles: await Assert.That(3.14).IsEqualTo(3.14159, tolerance: 0.01). [1]
    • Date/time comparisons can be combined with timing helpers (e.g., .Within) for range tolerance. [2]
  • Related: use Assert.Multiple() to group assertions; see equality & comparison section for other comparison assertions (IsNotEqualTo, IsGreaterThan, etc.). [3][1]

Primary docs:
[1] TUnit — Getting Started with Assertions (IsEqualTo examples).
[2] TUnit — Writing your first test (IsEqualTo usage).
[3] TUnit — Assertion Scopes / Multiple assertions.

If you want, I can fetch the exact API signature/overloads from the 1.2.11 package (source or assembly) and paste them here.


Align test body with its name to better showcase TUnit

The test named Add_WithTwoNumbers_ReturnsSum currently only asserts that true is true, which doesn't match the method name and misses an opportunity to demonstrate numeric assertions in TUnit.

Consider updating it to perform an actual addition with a numeric assertion:

-    [Test]
-    public async Task Add_WithTwoNumbers_ReturnsSum()
-    {
-        var result = true;
-        // Assert
-        await Assert.That(result).IsTrue();
-    }
+    [Test]
+    public async Task Add_WithTwoNumbers_ReturnsSum()
+    {
+        var result = 2 + 3;
+        await Assert.That(result).IsEqualTo(5);
+    }

This keeps the TUnit async assertion style while making the sample self-descriptive and demonstrating numeric comparison, which is more instructive for example code.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
public class FirstTest
{
[Test]
public async Task Add_WithTwoNumbers_ReturnsSum()
{
var result = true;
// Assert
await Assert.That(result).IsTrue();
}
public class FirstTest
{
[Test]
public async Task Add_WithTwoNumbers_ReturnsSum()
{
var result = 2 + 3;
await Assert.That(result).IsEqualTo(5);
}
}
🤖 Prompt for AI Agents
In v2/rscg_examples/TUnit/src/TestDemo/FirstTest.cs around lines 4 to 12, the
test method Add_WithTwoNumbers_ReturnsSum currently only asserts true and
doesn't perform any numeric operation; replace the placeholder with a simple
addition (e.g., compute a + b), then use the TUnit async assertion pattern to
verify the computed sum equals the expected value (use Await
Assert.That(...).IsEqualTo(expected) or the equivalent async numeric assertion
provided by TUnit), keeping the method async and ensuring variable names and the
assertion match the test name.

Comment on lines +35 to +37
{"typeStep":"browser","arg":"https://ignatandrei.github.io/RSCG_Examples/v2/docs/TUnit#download-example-net--c-",
SpeakTest=" "},
{"typeStep":"waitseconds","arg":"30"},
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Fix invalid JSON due to SpeakTest fragment

The SpeakTest=" " fragment makes this file invalid JSON, so any JSON parser will fail on this script.

You can fix it by removing the stray SpeakTest part so the step matches the surrounding ones:

-{"typeStep":"browser","arg":"https://ignatandrei.github.io/RSCG_Examples/v2/docs/TUnit#download-example-net--c-",
-SpeakTest=" "},
-{"typeStep":"waitseconds","arg":"30"},
+{"typeStep":"browser","arg":"https://ignatandrei.github.io/RSCG_Examples/v2/docs/TUnit#download-example-net--c-"},
+{"typeStep":"waitseconds","arg":"30"},
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
{"typeStep":"browser","arg":"https://ignatandrei.github.io/RSCG_Examples/v2/docs/TUnit#download-example-net--c-",
SpeakTest=" "},
{"typeStep":"waitseconds","arg":"30"},
{"typeStep":"browser","arg":"https://ignatandrei.github.io/RSCG_Examples/v2/docs/TUnit#download-example-net--c-"},
{"typeStep":"waitseconds","arg":"30"},
🧰 Tools
🪛 Biome (2.1.2)

[error] 35-36: Property key must be double quoted

(parse)


[error] 36-36: unexpected character =

(parse)


[error] 36-36: expected , but instead found " "

Remove " "

(parse)


[error] 36-36: expected : but instead found }

Remove }

(parse)

🤖 Prompt for AI Agents
In v2/rscg_examples/TUnit/video.json around lines 35 to 37, the JSON is invalid
because of the stray SpeakTest=" " fragment inside the object; remove the
SpeakTest fragment so the object becomes a normal step (i.e., only include the
typeStep and arg fields like the surrounding entries), ensuring the file is
valid JSON and commas/array structure remain correct.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds TUnit as the 239th Roslyn Source Code Generator example to the repository. TUnit is a modern testing framework for .NET that uses source-generated tests, parallel execution by default, and Native AOT support.

Key Changes

  • Adds comprehensive documentation for TUnit including usage examples, benchmarks, and migration guides
  • Updates all count references from 238 to 239 RSCG examples across documentation files
  • Includes new example project with test code and generated source files

Reviewed changes

Copilot reviewed 23 out of 25 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
v2/rscg_examples_site/static/sources/TUnit.zip Binary archive containing TUnit example source code
v2/rscg_examples_site/static/exports/RSCG.xlsx Updated Excel export with TUnit entry (binary)
v2/rscg_examples_site/static/exports/RSCG.json Added TUnit metadata entry to JSON export
v2/rscg_examples_site/src/components/HomepageFeatures/index.js Updated example count from 238 to 239
v2/rscg_examples_site/docs/indexRSCG.md Added TUnit to chronological list and updated counts
v2/rscg_examples_site/docs/about.md Updated RSCG count from 238 to 239
v2/rscg_examples_site/docs/RSCG-Examples/index.md Added TUnit to Tests category and updated counts
v2/rscg_examples_site/docs/RSCG-Examples/TUnit.md New comprehensive documentation page for TUnit
v2/rscg_examples_site/docs/Categories/_PrimitiveTests.mdx Added TUnit to Tests category listing
v2/rscg_examples_site/docs/Categories/Tests.md Added TUnit entry and updated count
v2/rscg_examples/TUnit/video.json Video script configuration for TUnit demo
v2/rscg_examples/TUnit/src/TestDemo/TestDemo.csproj Example project file with TUnit package reference
v2/rscg_examples/TUnit/src/TestDemo/FirstTest.cs Example test class demonstrating TUnit usage
v2/rscg_examples/TUnit/src/TestDemo.slnx Solution file for TUnit example
v2/rscg_examples/TUnit/readme.txt README content extracted from TUnit repository
v2/rscg_examples/TUnit/description.json TUnit metadata configuration
v2/book/pandocHTML.yaml Added TUnit to book generation input files
v2/book/list.html Added TUnit to HTML list of examples
v2/book/examples/TUnit.html Generated HTML page for TUnit example
v2/RSCGExamplesData/GeneratorDataRec.json Added TUnit generator record
v2/Generator/all.csv Added TUnit entry to CSV list
v2/Generator/MultiGeneratorV2.cs Added assets/banner path replacement support
v2/.tours/TUnit.tour VS Code tour configuration for TUnit example
later.md Updated latest update date to 2025-11-08
README.md Added TUnit entry and updated counts

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

[Arguments("value2")]
[Retry(3)]
[ParallelLimit<CustomLimit>]
public async Task Modern_TUnit_Test(string value) \{ }
Copy link

Copilot AI Nov 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Incorrect escaped braces in the markdown documentation. The backslashes before the braces should be removed. The line should be:

public async Task Modern_TUnit_Test(string value) { }
Suggested change
public async Task Modern_TUnit_Test(string value) \{ }
public async Task Modern_TUnit_Test(string value) { }

Copilot uses AI. Check for mistakes.
,{
"file": "rscg_examples/TUnit/src/TestDemo/FirstTest.cs",
"description": "File FirstTest.cs ",
"pattern": "this is the code"
Copy link

Copilot AI Nov 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pattern "this is the code" doesn't match any text in the FirstTest.cs file. Based on the file content, this pattern should be removed or changed to match actual code content (e.g., "namespace TestDemo" or "FirstTest").

Suggested change
"pattern": "this is the code"
"pattern": "namespace TestDemo"

Copilot uses AI. Check for mistakes.
Comment on lines +35 to +36
{"typeStep":"browser","arg":"https://ignatandrei.github.io/RSCG_Examples/v2/docs/TUnit#download-example-net--c-",
SpeakTest=" "},
Copy link

Copilot AI Nov 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing closing quote for the arg parameter. The line should be:

{"typeStep":"browser","arg":"https://ignatandrei.github.io/RSCG_Examples/v2/docs/TUnit#download-example-net--c-"},

The SpeakTest property should be on a separate line if needed, or removed entirely.

Suggested change
{"typeStep":"browser","arg":"https://ignatandrei.github.io/RSCG_Examples/v2/docs/TUnit#download-example-net--c-",
SpeakTest=" "},
{"typeStep":"browser","arg":"https://ignatandrei.github.io/RSCG_Examples/v2/docs/TUnit#download-example-net--c-"},

Copilot uses AI. Check for mistakes.
{"typeStep":"text","arg": "Remember, you can download the code from here"},
{"typeStep":"browser","arg":"https://ignatandrei.github.io/RSCG_Examples/v2/docs/TUnit#download-example-net--c-",
SpeakTest=" "},
{"typeStep":"waitseconds","arg":"30"},
Copy link

Copilot AI Nov 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trailing comma after the last array element is invalid JSON. Remove the comma after line 37.

Suggested change
{"typeStep":"waitseconds","arg":"30"},
{"typeStep":"waitseconds","arg":"30"}

Copilot uses AI. Check for mistakes.
// Custom conditional execution
public class WindowsOnlyAttribute : SkipAttribute
{
public WindowsOnlyAttribute() : base("Windows only test") \{ }
Copy link

Copilot AI Nov 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Incorrect escaped braces in the markdown documentation. The backslashes before the braces (\{ }) should be removed. In markdown, braces don't need to be escaped. The line should be:

public WindowsOnlyAttribute() : base("Windows only test") { }

Copilot uses AI. Check for mistakes.
// Custom retry logic
public class RetryOnHttpErrorAttribute : RetryAttribute
{
public RetryOnHttpErrorAttribute(int times) : base(times) \{ }
Copy link

Copilot AI Nov 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Incorrect escaped braces in the markdown documentation. The backslashes before the braces should be removed. The line should be:

public RetryOnHttpErrorAttribute(int times) : base(times) { }

Copilot uses AI. Check for mistakes.

public override Task<bool> ShouldRetry(TestInformation testInformation,
Exception exception, int currentRetryCount)
=> Task.FromResult(exception is HttpRequestException \{ StatusCode: HttpStatusCode.ServiceUnavailable });
Copy link

Copilot AI Nov 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Incorrect escaped braces in the markdown documentation. The backslashes before the braces should be removed. The line should be:

=> Task.FromResult(exception is HttpRequestException { StatusCode: HttpStatusCode.ServiceUnavailable });

Copilot uses AI. Check for mistakes.
@ignatandrei ignatandrei merged commit ff768f6 into main Nov 28, 2025
8 of 10 checks passed
@ignatandrei ignatandrei deleted the 424-tunit branch November 28, 2025 18:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

tunit

2 participants