I see two possible ways to do it:
1. One of the way is to abstract Xamarin.Forms classes, like displayed in this blog https://intellitect.com/unit-testing-xamarin-forms
2. Other way is to use https://github.com/jonathanpeppers/Xamarin.Forms.Mocks NuGet package
In my case, I need to mock Device.BeginInvokeOnMainThread and Device.Idiom, so maybe introducing the whole NuGet package is not worth it?
I would like to hear what way do you prefer.