Summary
In this chapter, we introduced unit test development for .NET MAUI apps. There are multiple test frameworks available. We chose xUnit as the framework in this chapter. In the MVVM pattern, the unit test of the model layer is the same as with any other .NET application. We developed test cases for the IDataStore
interface to test our model layer. For the unit test of the view and view model, we focused on the eBlazor Hybrid app using the bUnit test library. We can develop an end-to-end unit test for a Blazor Hybrid app with the xUnit framework and bUnit library. With bUnit, we covered topics such as Razor templates, the RenderFragment
delegate, dependency injection, and the Moq
framework.
Given the knowledge about unit testing in this chapter, you should now be able to work on your own unit test development. Please refer to the Further reading section to find more information on.NET unit test development.
Unit testing can be part of a CI/CD pipeline. With the CI/CD setup...