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
The test fails because the event doesn't trigger in the vacuum. The entry needs to be part of a view tree which means, an app, a window, a page and finally, my entry.
I haven't found any written support at all. This seems a regular case, doesn't it? Nobody tests if the event has been triggered and other activities?
Going further, I went to the mother of the deep rabbit holes, the Github Microsoft Maui repository, and find many tests involving an app.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
I'm trying to test properly, not only existence but also behavior.
Frequently, I need to interact with the Application objects.
For example, I need to test that an entry triggers the Unfocused event:
The test fails because the event doesn't trigger in the vacuum. The entry needs to be part of a view tree which means, an app, a window, a page and finally, my entry.
I haven't found any written support at all. This seems a regular case, doesn't it? Nobody tests if the event has been triggered and other activities?
Going further, I went to the mother of the deep rabbit holes, the Github Microsoft Maui repository, and find many tests involving an app.
For example:
It became very confusing because there is not a proper set of requirements. For example, how deep it goes when the fixture constructor does this:
I simply don't know how and what are the implications of such code.
There are many other stubs and mocks, but I've had similar issues.
So, I have two questions:
Is there any documentation about mocking Maui Apps and its properties?
How do I test around code that contains App and other references, like:
if (header is not null && App.Current.Resources.TryGetValue(...
I can always use wrappers, but doesn't that is just kinking the can down the street?
Thanks in advance.
Miguel Delgado
Beta Was this translation helpful? Give feedback.
All reactions