You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+29Lines changed: 29 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,6 +6,35 @@ All notable changes to **bUnit** will be documented in this file. The project ad
6
6
7
7
## [Unreleased]
8
8
9
+
This first release of 2022 includes a one fix and four additions. A huge thank you to [Steven Giesel (@linkdotnet)](https://github.com/linkdotnet) and [Denis Ekart (@denisekart)](https://github.com/denisekart) for their contributions to this release.
10
+
11
+
Also a big shout out to **bUnit's sponsors** who helped make this release happen.
- Added `FakeSignOutSessionStateManage` type in Blazor, that makes it easy to test components that use the `SignOutSessionStateManage` type. By [@linkdotnet](https://github.com/linkdotnet).
30
+
- Added a validation to `AddChildContent` method in `ComponentParameterCollectionBuilder` that will throw an exception if the component's `ChildContent` is a generic type. By [@denisekart](https://github.com/denisekart).
31
+
- Added more optional arguments for `Click` and `DoubleClick` extensions which were introduced in .NET 5 and .NET 6. By [@linkdotnet](https://github.com/linkdotnet).
32
+
- Added template support for `Nunit` and `MSTest` unit test frameworks. By [@denisekart](https://github.com/denisekart).
33
+
34
+
### Fixed
35
+
36
+
- Changed `GetDispatchEventTasks` for bubbling events such that handled exceptions are not rethrown later from the `WaitFor...` helpers methods. Reported by [@AndrewStrickland](https://github.com/AndrewStrickland). Fixed by [@linkdotnet](https://github.com/linkdotnet)
37
+
9
38
## [1.4.15] - 2021-12-18
10
39
11
40
This release reintroduces `Stub<TComponent>` and related back into the main library, so the "preview" library `bunit.web.mock` is already obsolete.
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+2-1Lines changed: 2 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,7 +15,8 @@ bUnit accepts fixes and features. Here is what you should do when writing code f
15
15
16
16
- Follow the coding conventions used throughout the bUnit project. In general, they align with the AspNetCore teams [coding guidelines](https://github.com/dotnet/aspnetcore/wiki/Engineering-guidelines#coding-guidelines).
17
17
- Add, remove, or delete unit tests to cover your changes. Make sure tests are specific to the changes you are making. Tests need to be provided for every bug/feature that is completed.
18
-
- This repository follow the truck-based development approach, meaning changes should be based on the `main` branch
18
+
- This repository follow the truck-based development approach, meaning changes should be based on the `main` branch.
19
+
- Use [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) style commit messages.
19
20
- Any code or documentation you share with the bUnit projects should fall under the projects license agreement.
20
21
21
22
Here are some resources to help you get started on how to contribute code or new content:
Copy file name to clipboardExpand all lines: README.md
+6Lines changed: 6 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -66,6 +66,12 @@ A huge thank you to the [sponsors of my work with bUnit](https://github.com/spon
66
66
67
67
Shout outs and a big thank you [to all the contributors](https://github.com/bUnit-dev/bUnit/graphs/contributors) to the library, including those that raise issues, provide input to issues, and those who send pull requests. Thank you!
68
68
69
+
These good people have contributed code or documentation to bUnit:
Copy file name to clipboardExpand all lines: docs/site/docs/getting-started/create-test-project.md
+26-6Lines changed: 26 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,9 +5,9 @@ title: Creating a new bUnit test project
5
5
6
6
# Creating a new bUnit test project
7
7
8
-
To write tests, you need a place to put them - a test project. bUnit is not a unit test runner, so a general-purpose test framework like xUnit, NUnit, or MSTest is needed in addition to bUnit in order to write and run tests.
8
+
To write tests, you need a place to put them - a test project. bUnit is not a unit test runner, so a general-purpose test framework like xUnit, NUnit, or MSTest is needed in addition to bUnit in order to write and run tests.
9
9
10
-
To use bUnit with xUnit, the easiest approach is to use the bUnit project template described in the [Create a test project with bUnit template](#creating-a-test-project-with-bunit-template) section further down the page. To create a test project manually and in a general-purpose testing frameworks agnostic way, read the following section.
10
+
To use bUnit, the easiest approach is to use the bUnit project template described in the [Create a test project with bUnit template](#creating-a-test-project-with-bunit-template) section further down the page. To create a test project manually and in a general-purpose testing frameworks agnostic way, read the following section.
The test projects setting needs to be set to the following:
60
+
The test projects setting needs to be set to the following:
61
61
62
62
- the project's SDK needs to be set to `Microsoft.NET.Sdk.Razor`
63
63
- set the `<TargetFramework>` to `net6.0`
@@ -176,7 +176,7 @@ The result should be a test project with a `.csproj` that looks like this (non b
176
176
177
177
## Creating a test project with bUnit template
178
178
179
-
To skip a few steps in the guide above, use the [bUnit test project template](https://www.nuget.org/packages/bunit.template/). The bUnit project template currently only works with the xUnit general-purpose testing framework, but other frameworks will be supported in the future.
179
+
To skip a few steps in the guide above, use the [bUnit test project template](https://www.nuget.org/packages/bunit.template/).
180
180
181
181
The steps for creating a test project with the bUnit template are as follows:
182
182
@@ -198,11 +198,31 @@ dotnet new --install bunit.template::#{NBGV_NuGetPackageVersion}#
198
198
199
199
Use the following command to create a bUnit with xUnit test project:
200
200
201
+
# [xUnit](#tab/xunit)
202
+
201
203
```dotnetcli
202
-
dotnet new bunit -o <NAME OF TEST PROJECT>
204
+
dotnet new bunit --framework xunit -o <NAME OF TEST PROJECT>
203
205
```
204
206
205
-
The `-o` option in the `dotnet new` command above is used to specify the name of the test project.
207
+
# [NUnit](#tab/nunit)
208
+
209
+
```dotnetcli
210
+
dotnet new bunit --framework nunit -o <NAME OF TEST PROJECT>
211
+
```
212
+
213
+
# [MSTest](#tab/mstest)
214
+
215
+
```dotnetcli
216
+
dotnet new bunit --framework mstest -o <NAME OF TEST PROJECT>
217
+
```
218
+
219
+
***
220
+
221
+
The `--framework` option in the `dotnet new` command above is used to specify the unit testing framework used by the test project. If the `--framework` option is omitted, the default test framework `xunit` will be configured. Currently supported options are the following:
Copy file name to clipboardExpand all lines: src/bunit.core/ComponentParameterCollectionBuilder.cs
+7Lines changed: 7 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -246,6 +246,9 @@ public ComponentParameterCollectionBuilder<TComponent> AddChildContent(RenderFra
246
246
if(!HasChildContentParameter())
247
247
thrownewArgumentException($"The component '{typeof(TComponent)}' does not have a {ChildContent} [Parameter] attribute.",nameof(childContent));
248
248
249
+
if(HasGenericChildContentParameter())
250
+
thrownewArgumentException($"Calling AddChildContent on component '{typeof(TComponent)}' with a generic {ChildContent} type (RenderFragment<T>) is not supported. Use the 'Add(p => p.ChildContent, p => {{content}})' method instead.",nameof(childContent));
0 commit comments