According to the original blog "Behaviors are powerful because they are reusable and easy to incorporate into unit testing since they are an independent piece of functionality."
But it appears, it's not that easy to build platform independent unit test, as none of the visual elements in Xamarin are interface based, so there's no way to create mocks of them, and test the behavior in isolation.
Using a "real" elements also does not work, unless you go the UI test route.
The behavior needs to listen to some events (especially Focused), and element.Focus() does not work and returns false when it's not part of a "real" UI. And I try to avoid creating 2 platform specific tests for that.
So, how should I approach this?
Aucun commentaire:
Enregistrer un commentaire