Reader small image

You're reading from  The MVVM Pattern in .NET MAUI

Product typeBook
Published inNov 2023
Reading LevelBeginner
PublisherPackt
ISBN-139781805125006
Edition1st Edition
Languages
Right arrow
Author (1)
Pieter Nijs
Pieter Nijs
author image
Pieter Nijs

Pieter Nijs is a .NET consultant at Xebia in Belgium, with a keen interest in mobile and cloud development. He's been instrumental in diverse projects, from vast healthcare and telecom systems to compact LOB apps. Now, Pieter's exploring AI's potential to enhance customer projects innovatively. Passionate about technology, he actively experiments and shares knowledge as a conference speaker and trainer. Pieter has been awarded the Microsoft MVP Award since 2017, reflecting his unwavering passion and expertise in serving the community.
Read more about Pieter Nijs

Right arrow

Testing MAUI-specific code

As shown in the previous examples, the majority of our code can be tested independently of the platform. But let’s not forget that there is code in our MAUI project as well that could benefit from some unit tests.

Let’s start by adding a new project to hold our tests for the Recipes.Mobile project:

  1. Add a new xUnit Test Project type, just as we did at the beginning of this chapter. Name this project Recipes.Mobile.UnitTests.
  2. Once the project has been created, add a reference to the Recipes.Mobile project.
  3. Add the AutoBogus NuGet package to this project.

The Recipes.Mobile.UnitTests project doesn’t target any specific frameworks other than net8.0. Because of that, we need to make sure net8.0 is on the list of target frameworks of the MAUI project as well. Also, we need to make sure that when the Recipes.Mobile project targets this additional net8.0 framework, it doesn’t output an EXE file. Let’s see...

lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
The MVVM Pattern in .NET MAUI
Published in: Nov 2023Publisher: PacktISBN-13: 9781805125006

Author (1)

author image
Pieter Nijs

Pieter Nijs is a .NET consultant at Xebia in Belgium, with a keen interest in mobile and cloud development. He's been instrumental in diverse projects, from vast healthcare and telecom systems to compact LOB apps. Now, Pieter's exploring AI's potential to enhance customer projects innovatively. Passionate about technology, he actively experiments and shares knowledge as a conference speaker and trainer. Pieter has been awarded the Microsoft MVP Award since 2017, reflecting his unwavering passion and expertise in serving the community.
Read more about Pieter Nijs