Skip to content

Commit 1fe9b86

Browse files
committed
Merge branch 'main' into dev
2 parents 6c66b41 + 6398bbc commit 1fe9b86

17 files changed

+154
-1348
lines changed

README.md

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,11 @@
88

99
**bUnit** is a testing library for Blazor Components. Its goal is to make it easy to write _comprehensive, stable unit tests_. You can:
1010

11-
- Setup and define components under tests in C# or Razor syntax
11+
- Setup and define components under tests using C# or Razor syntax
1212
- Verify outcome using semantic HTML comparer
13-
- Interact with and inspect components
14-
- Trigger event handlers
15-
- Provide cascading values
16-
- Inject services
17-
- Mock `IJsRuntime`
13+
- Interact with and inspect components, trigger event handlers
14+
- Pass parameters, cascading values and inject services into components under test
15+
- Mock `IJsRuntime` and Blazors authentication and authorization
1816
- Perform snapshot testing
1917

2018
bUnit builds on top of existing unit testing frameworks such as xUnit, NUnit, and MSTest, which runs the Blazor components tests, just as any normal unit test.
@@ -27,14 +25,20 @@ bUnit is available on NuGet in various incarnations. If you are using xUnit as y
2725

2826
| Name | Type | NuGet Download Link |
2927
| ----- | ----- | ---- |
30-
| bUnit | Library, includes core, web, and xUnit | [![Nuget](https://img.shields.io/nuget/dt/bunit?logo=nuget&style=flat-square)](https://www.nuget.org/packages/bunit/) |
28+
| bUnit | Library, includes core, web, and xUnit support | [![Nuget](https://img.shields.io/nuget/dt/bunit?logo=nuget&style=flat-square)](https://www.nuget.org/packages/bunit/) |
3129
| bUnit.core | Library, only core | [![Nuget](https://img.shields.io/nuget/dt/bunit.core?logo=nuget&style=flat-square)](https://www.nuget.org/packages/bunit.core/) |
3230
| bUnit.web | Library, web and core | [![Nuget](https://img.shields.io/nuget/dt/bunit.web?logo=nuget&style=flat-square)](https://www.nuget.org/packages/bunit.web/) |
33-
| bUnit.xUnit |Library, xUnit and core | [![Nuget](https://img.shields.io/nuget/dt/bunit.xunit?logo=nuget&style=flat-square)](https://www.nuget.org/packages/bunit.xunit/) |
31+
| bUnit.xUnit | Library, xUnit and core | [![Nuget](https://img.shields.io/nuget/dt/bunit.xunit?logo=nuget&style=flat-square)](https://www.nuget.org/packages/bunit.xunit/) |
3432
| bUnit.template | Template, which currently creates an xUnit based bUnit test projects only | [![Nuget](https://img.shields.io/nuget/dt/bunit.template?logo=nuget&style=flat-square)](https://www.nuget.org/packages/bunit.template/) |
3533

3634
To get started, head to the [getting started documentation](https://bunit.egilhansen.com/docs/getting-started) to learn more.
3735

36+
## Sponsors
37+
38+
A hugh thank you to the [sponsors of my work with bUnit](https://github.com/sponsors/egil). The higher tier sponsors are:
39+
40+
- [Hassan Rezk Habib (@hassanhabib)](https://github.com/hassanhabib)
41+
3842
## Milestones to v1.0.0
3943

4044
These are the current goals that should be reached before v1.0.0 is ready:

docs/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,5 @@ To build and view the documentation locally, a few steps is needed:
2828

2929
- All pages should have a [YAML header](https://dotnet.github.io/docfx/spec/docfx_flavored_markdown.html#yaml-header) with an `UID` to enable easy [cross reference](https://dotnet.github.io/docfx/spec/docfx_flavored_markdown.html#cross-reference) between pages
3030
- All page and code references should be created using the [`xref:UID` cross reference syntax](https://dotnet.github.io/docfx/tutorial/links_and_cross_references.html#using-cross-reference).
31-
- Prefer to include code snippets as from sample files in the `samples` projects, using the [code snippet syntax](https://dotnet.github.io/docfx/spec/docfx_flavored_markdown.html#code-snippet).
32-
- All code snippets should use 2 spaces as an indention unit (1 tab = 2 spaces)
31+
- Prefer to include code snippets as sample files in the `samples` projects, using the [code snippet syntax](https://dotnet.github.io/docfx/spec/docfx_flavored_markdown.html#code-snippet).
32+
- All code snippets should use 2 spaces as an indention unit (1 tab = 2 spaces)
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
using Xunit;
2+
using Bunit;
3+
4+
namespace Bunit.Docs.Samples
5+
{
6+
public class CounterTestWithCtx
7+
{
8+
[Fact]
9+
public void CounterShouldIncrementWhenClicked()
10+
{
11+
// Arrange: render the Counter.razor component
12+
using var ctx = new TestContext();
13+
var cut = ctx.RenderComponent<Counter>();
14+
15+
// Act: find and click the <button> element to increment
16+
// the counter in the <p> element
17+
cut.Find("button").Click();
18+
19+
// Assert: first find the <p> element, then verify its content
20+
cut.Find("p").MarkupMatches("<p>Current count: 1</p>");
21+
}
22+
}
23+
}

docs/site/docs/basics-of-blazor-component-testing.md

Lines changed: 0 additions & 28 deletions
This file was deleted.

docs/site/docs/contribute.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
---
2+
uid: contribute
3+
title: Contribute
4+
---
5+
16
# Contribute
27

38
To get in touch, ask questions or provide feedback, you can:

docs/site/docs/csharp-based-testing.md

Lines changed: 0 additions & 179 deletions
This file was deleted.

0 commit comments

Comments
 (0)