Skip to content

Commit 1d7e108

Browse files
committed
squash! .github/instructions/fuzzy.instructions.md
1 parent 082c06c commit 1d7e108

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

.github/instructions/fuzzy.instructions.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,15 @@ applyTo: "test/**/*.cs"
3939
- For numbers, use `x + fuzzy.SByte().Between(1, 5)`
4040
- For dates and timestamps, use `x + fuzzy.TimeSpan().Seconds()`
4141

42+
- **Don't hard-code number of elements when generating serialized collections**.
43+
Hard-coding number of elements, typically to a small number of elements, like 2, can hide bugs in the product code due
44+
to hard-coded expectations. Use fuzzy collections, like `fuzzy.Array(...)`, and synthesize serialized representation required
45+
by the test, such as a coma-separated list.
46+
```csharp
47+
string wrong = $"{fuzzy.Int32()},{fuzzy.Int32()}"; // ❌ 2 elements
48+
var correct = string.Join(",", fuzzy.Array(fuzzy.Int32).Select(_ => _.ToString())); // ✅ Fuzzy number of elements
49+
```
50+
4251
- Report unexpected `Fuzzy` errors to the user.
4352
- Ask them to submit an issue to the `olegsych/fuzzy` repo on GitHub.
4453
- When implementing workarounds, add TODO comments with the explanation, package version and GitHub issue link.

0 commit comments

Comments
 (0)