jamesmontemagno / DeviceInfoPlugin

Device Information Plugin for Xamarin and Windows

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unit Test for Shared Project

michaelfkoenig opened this issue · comments

I am want to Unit Test some of my code that consumes DeviceInfo.

I found that if I use a Shared Project Unit Test on some methods that call into Device Info, that it throws an exeption of not having the Mono.Android runtime for some of the items, but not all of them. This is because it is being called from Unit Test Project, via the Android Project

Version 2.1.2

Returns values
CrossDeviceInfo.Current.Platform.ToString();
CrossDeviceInfo.Current.GenerateAppId().ToString();
CrossDeviceInfo.Current.VersionNumber.ToString();

Exception (Mono.Android runtime missing)
CrossDeviceInfo.Current.Model.ToString();
CrossDeviceInfo.Current.Idiom.ToString();
CrossDeviceInfo.Current.Version.ToString();
CrossDeviceInfo.Current.Id;

How are you able to Unit Test in a Shared Project using VS Unit Test Projects?