Skip to content

Commit 3ea3e3d

Browse files
authored
Merge pull request #452 from ignatandrei/448-knockoff---source-generated-hybrid-stubmock-library
knockoff
2 parents 93b55b5 + 29d4977 commit 3ea3e3d

33 files changed

Lines changed: 1940 additions & 53 deletions

File tree

README.md

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
# RSCG - 254 Examples of Roslyn Source Code Generators / 16 created by Microsoft /
1+
# RSCG - 255 Examples of Roslyn Source Code Generators / 16 created by Microsoft /
22

3-
The RSCG_Examples repository is a comprehensive documentation system that automatically processes and showcases 254 Roslyn Source Code Generator (RSCG) examples. The system transforms individual RSCG projects into structured documentation with code examples and cross-referenced content with a searchable website and code example exports.
3+
The RSCG_Examples repository is a comprehensive documentation system that automatically processes and showcases 255 Roslyn Source Code Generator (RSCG) examples. The system transforms individual RSCG projects into structured documentation with code examples and cross-referenced content with a searchable website and code example exports.
44

55
This system serves as both a learning resource for .NET developers interested in source generators and an automated pipeline for maintaining up-to-date documentation about the RSCG ecosystem
66

7-
## Latest Update : 2026-02-02 => 02 February 2026
7+
## Latest Update : 2026-02-13 => 13 February 2026
88

99
If you want to see examples with code, please click ***[List V2](https://ignatandrei.github.io/RSCG_Examples/v2/docs/List-of-RSCG)***
1010

@@ -24,8 +24,30 @@ If you want to be notified each time I add a new RSCG example , please click htt
2424

2525
## Content
2626

27-
Those are the 254 Roslyn Source Code Generators that I have tested you can see and download source code example.
27+
Those are the 255 Roslyn Source Code Generators that I have tested you can see and download source code example.
2828
( including 16 from Microsoft )
29+
### 255. [KnockOff](https://ignatandrei.github.io/RSCG_Examples/v2/docs/KnockOff) , in the [Tests](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#tests) category
30+
31+
Generated on : 2026-02-13 => 13 February 2026
32+
33+
<details>
34+
<summary>Expand</summary>
35+
36+
37+
38+
Author: Keith Voels
39+
40+
A Roslyn Source Generator for creating unit test stubs. Unlike Moq's fluent runtime configuration, KnockOff uses partial classes for compile-time setup—trading flexibility for readability and performance.
41+
42+
Nuget: [https://www.nuget.org/packages/KnockOff/](https://www.nuget.org/packages/KnockOff/)
43+
44+
45+
Link: [https://ignatandrei.github.io/RSCG_Examples/v2/docs/KnockOff](https://ignatandrei.github.io/RSCG_Examples/v2/docs/KnockOff)
46+
47+
Source: [https://github.com/NeatooDotNet/KnockOff](https://github.com/NeatooDotNet/KnockOff)
48+
49+
</details>
50+
2951
### 254. [ErrorOrX](https://ignatandrei.github.io/RSCG_Examples/v2/docs/ErrorOrX) , in the [API](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#api) category
3052

3153
Generated on : 2026-02-02 => 02 February 2026

later.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Just later
22

3-
## Latest Update : 2026-02-02 => 02 February 2026
3+
## Latest Update : 2026-02-13 => 13 February 2026
44

55

66

v2/.tours/KnockOff.tour

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
2+
{
3+
"$schema": "https://aka.ms/codetour-schema",
4+
"title": "KnockOff",
5+
"steps":
6+
[
7+
{
8+
"file": "rscg_examples/KnockOff/src/TestClock/TestClock.csproj",
9+
"description": "First, we add Nuget [KnockOff](https://www.nuget.org/packages/KnockOff/) in csproj ",
10+
"pattern": "KnockOff"
11+
}
12+
13+
,{
14+
"file": "rscg_examples/KnockOff/src/TestClock/TestClock.cs",
15+
"description": "File TestClock.cs ",
16+
"pattern": "this is the code"
17+
}
18+
19+
,{
20+
"file": "rscg_examples/KnockOff/src/Mock/IMyClock.cs",
21+
"description": "File IMyClock.cs ",
22+
"pattern": "this is the code"
23+
}
24+
25+
26+
,{
27+
"file": "rscg_examples/KnockOff/src/TestClock/obj/GX/KnockOff.Generator/KnockOff.KnockOffGenerator/QuickStartRepoStub.g.cs",
28+
"description": "Generated File 2 from 2 : QuickStartRepoStub.g.cs ",
29+
"line": 1
30+
}
31+
32+
,{
33+
"file": "rscg_examples/KnockOff/src/TestClock/obj/GX/KnockOff.Generator/KnockOff.KnockOffGenerator/QuickStartRepoStub.Base.g.cs",
34+
"description": "Generated File 1 from 2 : QuickStartRepoStub.Base.g.cs ",
35+
"line": 1
36+
}
37+
38+
],
39+
40+
"ref": "main"
41+
42+
}

v2/Generator/DocusaurusExample.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ Source: {{ Description.Generator.Source }}
4949
{{image}}
5050
:::
5151

52-
### Original Readme
52+
## Original Readme
5353
:::note
5454

5555
{{Description.OriginalReadme}}

v2/Generator/MultiGeneratorV2.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,9 +224,14 @@ public string[] SourceNoRSCG()
224224
text = text.Replace("(LICENSE.TXT)", $"({d.Generator!.Source}/LICENSE.TXT)");
225225
text = text.Replace("(docs/building.md)", $"({d.Generator!.Source}/docs/building.md)");
226226
text = text.Replace("(./", $"({d.Generator!.Source}/");
227-
227+
text = text.Replace("(skills/", $"({d.Generator!.Source}/skills");
228228

229229
text = text.Replace("Access them as a ReadOnlySpan<byte>", "Access them as a ReadOnlySpan\\<byte\\>");
230+
text = text.Replace("### ", "##### ");
231+
text = text.Replace("## ", "#### ");
232+
text = text.Replace("# ", "### ");
233+
text= text.Replace("C###", "C#");
234+
230235
return text;
231236
}
232237
;

v2/Generator/all.csv

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,3 +253,4 @@ Nr,Key,Source,Category
253253
252,RSCG_idempotency, https://github.com/ignatandrei/RSCG_idempotency,Idempotency
254254
253,FastCloner, https://github.com/lofcz/FastCloner/,Clone
255255
254,ErrorOrX, https://github.com/ANcpLua/ErrorOrX,API
256+
255,KnockOff, https://github.com/NeatooDotNet/KnockOff,Tests

v2/RSCGExamplesData/GeneratorDataRec.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1540,5 +1540,11 @@
15401540
"Category": 15,
15411541
"dtStart": "2026-02-02T00:00:00",
15421542
"show": true
1543+
},
1544+
{
1545+
"ID": "KnockOff",
1546+
"Category": 13,
1547+
"dtStart": "2026-02-13T00:00:00",
1548+
"show": true
15431549
}
15441550
]

v2/book/examples/ErrorOrX.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ <h1>RSCG nr 254 : ErrorOrX</h1>
44
<h2>Info</h2>
55
Nuget : <a href="https://www.nuget.org/packages/ErrorOrX/" target="_blank">https://www.nuget.org/packages/ErrorOrX/</a>
66

7-
<p>You can find more details at : <a href="https://github.com/ANcpLua/ErrorOrX/" target="_blank"> https://github.com/ANcpLua/ErrorOrX/</a></p>
7+
<p>You can find more details at : <a href="https://github.com/ANcpLua/ErrorOrX" target="_blank"> https://github.com/ANcpLua/ErrorOrX</a></p>
88

99
<p>Author :Alexander Nachtmanns</p>
1010

11-
<p>Source: <a href="https://github.com/ANcpLua/ErrorOrX/" target="_blank">https://github.com/ANcpLua/ErrorOrX/</a> </p>
11+
<p>Source: <a href="https://github.com/ANcpLua/ErrorOrX" target="_blank">https://github.com/ANcpLua/ErrorOrX</a> </p>
1212

1313
<h2>About</h2>
1414

v2/book/examples/KnockOff.html

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
2+
<h1>RSCG nr 255 : KnockOff</h1>
3+
4+
<h2>Info</h2>
5+
Nuget : <a href="https://www.nuget.org/packages/KnockOff/" target="_blank">https://www.nuget.org/packages/KnockOff/</a>
6+
7+
<p>You can find more details at : <a href="https://github.com/NeatooDotNet/KnockOff" target="_blank"> https://github.com/NeatooDotNet/KnockOff</a></p>
8+
9+
<p>Author :Keith Voels</p>
10+
11+
<p>Source: <a href="https://github.com/NeatooDotNet/KnockOff" target="_blank">https://github.com/NeatooDotNet/KnockOff</a> </p>
12+
13+
<h2>About</h2>
14+
15+
Generating test stubs with mocking for interfaces
16+
17+
<h2>
18+
How to use
19+
</h2>
20+
<h3>
21+
Add reference to the <a href="https://www.nuget.org/packages/KnockOff/" target="_blank">KnockOff</a> in the csproj
22+
</h3>
23+
<img src="images/KnockOff/TestClock.csproj.png" width="580" height="580" />
24+
25+
<h3>This was for me the <b>starting</b> code</h3>
26+
27+
<br />
28+
I have <b>coded</b> the file IMyClock.cs
29+
<br />
30+
<img src="images/KnockOff/csFiles/IMyClock.cs.png" width="580" height="580" />
31+
<hr />
32+
33+
<br />
34+
I have <b>coded</b> the file TestClock.cs
35+
<br />
36+
<img src="images/KnockOff/csFiles/TestClock.cs.png" width="580" height="580" />
37+
<hr />
38+
<h3>And here are the <i>generated</i> files</h3>
39+
40+
<br />
41+
The file <i>generated</i> is QuickStartRepoStub.Base.g.cs
42+
<br />
43+
<img src="images/KnockOff/generated/QuickStartRepoStub.Base.g.cs.png" width="580" height="580" />
44+
45+
<br />
46+
The file <i>generated</i> is QuickStartRepoStub.g.cs
47+
<br />
48+
<img src="images/KnockOff/generated/QuickStartRepoStub.g.cs.png" width="580" height="580" />
49+
50+
<p>
51+
You can download the code and this page as pdf from
52+
<a target="_blank" href='https://ignatandrei.github.io/RSCG_Examples/v2/docs/KnockOff'>
53+
https://ignatandrei.github.io/RSCG_Examples/v2/docs/KnockOff
54+
</a>
55+
</p>
56+
57+
58+
<p>
59+
You can see the whole list at
60+
<a target="_blank" href='https://ignatandrei.github.io/RSCG_Examples/v2/docs/List-of-RSCG'>
61+
https://ignatandrei.github.io/RSCG_Examples/v2/docs/List-of-RSCG
62+
</a>
63+
</p>
64+

v2/book/list.html

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
</head>
1818
<body>
1919
<h1>
20-
This is the list of 254 RSCG with examples =>
20+
This is the list of 255 RSCG with examples =>
2121
</h1>
2222

2323
<table >
@@ -1042,6 +1042,10 @@ <h1>
10421042
<td>254</td>
10431043
<td><a href="examples/ErrorOrX.html">ErrorOrX</a></td>
10441044
</tr>
1045+
<tr>
1046+
<td>255</td>
1047+
<td><a href="examples/KnockOff.html">KnockOff</a></td>
1048+
</tr>
10451049
</table>
10461050

10471051

0 commit comments

Comments
 (0)