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: docs/readme.md
+23-13Lines changed: 23 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -29,41 +29,51 @@ This framework's goal is to make it easy to write _comprehensive, stable unit te
29
29
Follow these steps to set up a new test project:
30
30
31
31
1. Create a new Razor Class Library (`dotnet new razorclasslib`).
32
-
2. Add the following package references to your testing library:
33
32
34
-
-`Razor.Components.Testing.Library`
33
+
2. Ensure `TargetFramework` is `netcoreapp3.1`, e.g. set `<TargetFramework>netcoreapp3.1</TargetFramework>` in your .csproj file.
34
+
35
+
3. Add the following package references to your testing library:
36
+
37
+
-`Razor.Components.Testing.Library` (make sure to get `1.0.0-beta-1` version)
35
38
-`Microsoft.NET.Test.Sdk`
36
39
-`xunit.core`
37
-
-`xunit.assert`
40
+
-`xunit.assert` (can be replaced with `Shouldly` or another assertion library)
38
41
-`xunit.runner.visualstudio` (if using Visual Studio)
39
42
40
43
Optionally, but recommended packages are [`Moq`](https://github.com/Moq) and [`Shouldly`](https://github.com/shouldly). _Moq_ is a good generic mocking library, and _Shouldly_ is a fluent syntax assert library, that makes test more readable and produce easily readable assert errors.
41
44
42
-
3. Add a reference to the Blazor (class library) project(s) where the components you want to test is located.
45
+
4. Add a reference to the Blazor (class library) project(s) where the components you want to test is located.
43
46
44
-
4. Start writing tests (see examples below to get started).
47
+
5. Start writing tests (see examples below to get started).
45
48
46
49
## Examples
47
50
48
51
Examples are split into three sections, one for each style/declaration type.
49
52
50
-
1.[C#-based tests](csharp-examples.md)
51
-
2.[Razor/C# mixed-mode tests](razor-examples.md)
52
-
3.[Snapshot tests](snapshot-examples.md)
53
+
1.[C#-based tests](csharp-examples.md)
54
+
Examples of tests written entirely in C#
55
+
2.[Razor/C# mixed-mode tests](razor-examples.md)
56
+
Examples of tests written in Razor files using Razor code to declare/arrange the component under test and expected HTML, and C# code for driving the test.
57
+
3.[Snapshot tests](snapshot-examples.md)
58
+
Examples of snapshot tests written in Razor code, where the component under test and expected output is declared in Razor syntax and automatically verified.
53
59
54
60
## References
55
61
56
-
See source code documentation for now.
62
+
The following sections are planned but not done yet. A lot of the public methods are however documented, so view the documentation in the source code for now.
63
+
64
+
Upcoming sections:
57
65
58
-
1.[Semantic HTML diffing options](html-diffing-options.md)
66
+
1.[Built-in assertions](#)
67
+
2.[Component creation and rendering](#)
68
+
3.[Semantic HTML diffing options](#)
59
69
60
70
## Contribute
61
71
62
72
To get in touch, ask questions or provide feedback, you can:
63
73
64
-
- Create a new [issue](https://github.com/egil/razor-components-testing-library/issues)
65
-
- Join the library's Gitter channel ([](https://gitter.im/razor-components-testing-library/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge))
66
-
- Ping me on Twitter ([@egilhansen](https://twitter.com/egilhansen))
74
+
- Create a new [issue](https://github.com/egil/razor-components-testing-library/issues).
75
+
- Join the library's Gitter channel [](https://gitter.im/razor-components-testing-library/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
76
+
- Ping me on Twitter: [@egilhansen](https://twitter.com/egilhansen)
67
77
68
78
There are a few ways you can help improve this library.
0 commit comments