Skip to content

Commit 7a67b5f

Browse files
committed
Created docs toc and outlined some docs
1 parent 9111ea6 commit 7a67b5f

22 files changed

Lines changed: 174 additions & 24 deletions

docs/.editorconfig

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ tab_size = 2
2323
tab_size = 2
2424

2525
[*.{ps1,psm1}]
26-
tab_size = 4
26+
tab_size = 2
2727

2828
[*.sh]
29-
tab_size = 4
29+
tab_size = 2
3030
end_of_line = lf
3131

3232
[*.{yml,yaml,md}]
@@ -37,6 +37,7 @@ tab_size = 2
3737
trim_trailing_whitespace = false
3838

3939
[*.{cs,razor}]
40+
tab_size = 2
4041
dotnet_diagnostic.BL0001.severity = none
4142
dotnet_diagnostic.BL0002.severity = none
4243
dotnet_diagnostic.BL0003.severity = none

docs/docs/getting-started/create-test-project.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ These steps look like this from the `dotnet` CLI:
2222

2323
**1. Create a new test project**
2424

25-
Use the following command:
25+
Use the following command (click on the tab that for the test framework you would like to use):
2626

2727
# [xUnit](#tab/xunit)
2828

File renamed without changes.

docs/docs/getting-started/writing-razor-tests.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,16 @@ title: Writing tests in Razor syntax for Blazor components
55

66
# Writing tests in Razor syntax for Blazor components
77

8-
A test for a Blazor component can be written in a Blazor component, using a mix of Razor and C# syntax. The advantage of this is the familiarity in declaring the component under test, and other HTML or Razor fragments that will be used in the test, in Razor and HTML markup. This is especially useful when testing components that takes a lot of parameters and child content as input.
9-
108
> [!WARNING]
119
> Razor tests are currently only compatible with using xUnit as the general purpose testing framework.
1210
11+
A test for a Blazor component can be written in a Blazor component, using a mix of Razor and C# syntax. The advantage of this is the familiarity in declaring the component under test, and other HTML or Razor fragments that will be used in the test, in Razor and HTML markup. This is especially useful when testing components that takes a lot of parameters and child content as input.
12+
13+
> [!TIP]
14+
> Tests declared inside Blazor test components can be discovered and invoked individually, and will show up in e.g. Visual Studio's Test Explorer.
15+
>
16+
> However, they will _not_ show up before the Blazor test component has been compiled into C# by the Blazor compiler, and if there are compile-errors from the Blazor compiler, they might appear to come and go in the Test Explorer.
17+
1318
## Create a test specific `_Imports.razor` file
1419

1520
Razor tests are written in Blazor test components. To make our life's a little easier, let's first set up a `_Imports.razor` file, with the using statements we are going to be using throughout our tests. Simply add the following `_Imports.razor` to the root folder where you will be placing your Blazor test components:

docs/docs/input/passing-parameters-to-components.md

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

docs/docs/misc-test-tips.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ A neat trick, which will limit the `import` statements needed in your test proje
3737
</PropertyGroup>
3838
```
3939

40+
## Capture logs from ILogger in test output
41+
42+
TODO: Document XunitLogger and XunitLoggerFactory
43+
4044
## Make copy/paste of HTML easier
4145

4246
When writing C# based tests, you sometime want to copy/paste some HTML into C# strings from e.g. a Razor file. This is tedious to do manually as you have to escape the quotes and other special characters. The extension, [SmartPaster2019](https://marketplace.visualstudio.com/items?itemName=martinw.SmartPaster2013), allows us to copy strings where any character that needs to be escaped will be automatically.

docs/docs/mocking/index.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
uid: mocking
3+
title: Mocking component dependencies
4+
---
5+
6+
# Mocking component dependencies
7+
8+
intro
9+
10+
Mention Moq, JustMock, say nothing special required.
11+
12+
Read more points to specific mocking guides for Blazor.

docs/docs/mocking/mocking-auth.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
uid: mocking-auth
3+
title: Mocking Blazor's Authorization
4+
---
5+
6+
# Mocking Blazor's Authorization
7+
8+
https://github.com/egil/bunit/issues/135
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
uid: mocking-httpclient
3+
title: Mocking HttpClient
4+
---
5+
6+
# Mocking `HttpClient`
7+
8+
TODO - https://github.com/egil/bunit/issues/61
Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
1-
# Mocking IJsRuntime
1+
---
2+
uid: mocking-ijsruntime
3+
title: Mocking Blazor's IJSRuntime
4+
---
5+
6+
# Mocking Blazor's `IJSRuntime`
27

38
This page is on the todo list.
49

510
To see examples of how to mock the JsRuntime, go to the [C# test examples](/docs/csharp-test-examples.html#testing-components-that-use-on-ijsruntime) page.
11+
12+
- TODO: https://github.com/egil/bunit/issues/67

0 commit comments

Comments
 (0)