Forum Xamarin.Forms

Device.OnPlatform in Unit Tests

Hey I want to run unit tests on code that contains Device.OnPlatform(ios,android,winphone);. Is there a possibility to say that the current test case should emulate a special OS like iOS or Android. Is there maybe a property that you can override or a build parameter.


  • ArminTelkerArminTelker USMember
       var field = typeof(Device).GetRuntimeProperty("OS");
       field.SetValue(null, TargetPlatform.Android);
Sign In or Register to comment.