Skip to content

Commit fcce009

Browse files
authored
Add PackageReadmeFile. (#888)
* Add PackageReadmeFile. * Update the changelog. * Add a separate package readme.
1 parent 314fe3c commit fcce009

File tree

3 files changed

+40
-0
lines changed

3 files changed

+40
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
* [UPDATE][BREAKING] Nullability is enabled for public api for .NET Core TFMs
1111
* [UPDATE] Migrate to slnx format for solution file
1212
* [UPDATE] Migrate documentation validation from build.fsproj to Roslyn code generator
13+
* [NEW] Added NuGet Package README file.
1314

1415
### 5.3.0 (October 2024)
1516

src/NSubstitute/NSubstitute.csproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
<PackageId>NSubstitute</PackageId>
2020
<PackageTags>mocking;mocks;testing;unit-testing;TDD;AAA</PackageTags>
2121
<PackageIcon>icon.png</PackageIcon>
22+
<PackageReadmeFile>README.md</PackageReadmeFile>
2223
<PackageProjectUrl>https://nsubstitute.github.io/</PackageProjectUrl>
2324
<PackageLicenseExpression>BSD-3-Clause</PackageLicenseExpression>
2425
<RepositoryUrl>https://github.com/nsubstitute/NSubstitute</RepositoryUrl>
@@ -45,6 +46,7 @@
4546

4647
<ItemGroup>
4748
<None Include="..\..\docs\images\nsubstitute-100x100.png" Pack="true" PackagePath="icon.png" Visible="false" />
49+
<None Include="README.md" Pack="true" PackagePath="\" />
4850
</ItemGroup>
4951

5052
<ItemGroup>

src/NSubstitute/README.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# NSubstitute
2+
3+
A friendly substitute for .NET mocking libraries.
4+
5+
Perfect for those new to testing, and for others who would just like to to get their tests written with less noise and fewer lambdas.
6+
7+
## How to use
8+
9+
```csharp
10+
// Create:
11+
var calculator = Substitute.For<ICalculator>();
12+
13+
// Set a return value:
14+
calculator.Add(1, 2).Returns(3);
15+
Assert.AreEqual(3, calculator.Add(1, 2));
16+
17+
// Check received calls:
18+
calculator.Received().Add(1, Arg.Any<int>());
19+
calculator.DidNotReceive().Add(2, 2);
20+
21+
// Raise events
22+
calculator.PoweringUp += Raise.Event();
23+
```
24+
25+
## Optional Roslyn analysers
26+
27+
- For C# projects: [NSubstitute.Analyzers.CSharp](https://www.nuget.org/packages/NSubstitute.Analyzers.CSharp/)
28+
- For VB projects: [NSubstitute.Analyzers.VisualBasic](https://www.nuget.org/packages/NSubstitute.Analyzers.VisualBasic/)
29+
30+
## Getting help
31+
32+
If you have questions, feature requests or feedback on NSubstitute please [raise an issue](https://github.com/nsubstitute/NSubstitute/issues) on our project site.
33+
34+
## More information
35+
36+
- Visit [NSubstitute website](https://nsubstitute.github.io) for more examples and documentation.
37+
- Visit [NSubstitute on GitHub](https://github.com/nsubstitute/NSubstitute).

0 commit comments

Comments
 (0)