-
-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Enhancement] Is there a version planned for .NET MAUI? #76
Comments
I hadn't planned on doing anything here yet. It might be possible to do it yourself already, you can look at MAUI's tests and copy what they do? This is just a random example: https://github.com/dotnet/maui/blob/main/src/Controls/tests/Core.UnitTests/ContentViewUnitTest.cs |
In case it helps anyone else as it did for some of my unit tests. This worked when I wanted to check some code that did things with resource dictionaries in App.Current and I had this in my test constructor (I previously also used this NuGet package in the constructor): public ExampleTest()
{
Application.Current = new App();
} Update your public partial class App : Application
{
public App()
{
#if ANDROID || MACCATALYST || IOS || WINDOWS
// don't call InitializeComponent in unit tests
InitializeComponent();
#endif
}
#if NET7_0_OR_GREATER && !ANDROID && !MACCATALYST && !IOS && !WINDOWS
// workaround for unit tests in Maui https://github.com/dotnet/maui/issues/3552#issuecomment-1172606125
public static void Main(string[] args) {}
#endif
} |
Hello @jonathanpeppers,
first of all, thank you for writing this tool. It helps us a lot when we write component and integration tests.
Is there a plan to have a similar tool for .NET MAUI?
I haven't figured out how to write it myself. At least until now.
The text was updated successfully, but these errors were encountered: