Razor component testing using bUnit
In .NET MAUI development, we cannot create unit test cases for all view and view model layers in XAML-based UI components; however, this is possible with Blazor. bUnit is an exceptional test library that can be employed for developing unit tests for Razor components. The bUnit library facilitates the creation of unit test cases for Razor components using xUnit, NUnit, or MSTest. Throughout the remainder of this chapter, we will utilize xUnit in conjunction with bUnit. The structure of unit test cases using bUnit bears similarity to the xUnit test cases we discussed in the previous section.
In the remainder of this chapter, we will focus on testing the following Razor components, which were created in the second part of this book:
- Razor components in the
PassXYZ.BlazorUI
project - Razor components in the
PassXYZ.Vault
project
To test Razor components using bUnit, it is necessary to modify the project configuration of PassXYZ...