Xamarin android mocking shared preferences -


i have android unit test project uses nunit test xamarin android project , need mock shared preferences object. have attempted use following mock isharedpreferences:

new mockcontext().getsharedpreferences("",android.content.filecreationmode.append); 

however results in following exception:

java.lang.classnotfoundexception: didn't find class "android.test.mock.mockcontext" 

i have included following using statement in project using android.test.mock.

i not know why cannot find class when code compiles , builds in xamarin?

it turns out of these class not yet supported xamarin yet. other users have alluded in previous posts well: testing activities in xamarin.android

unfortunately there no solution mocking of yet xamarin. see other question @ mocking framework use xamarin android. have live using manual mocking.


Comments

Popular posts from this blog

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -

php - Magento - Deleted Base url key -

android - How to disable Button if EditText is empty ? -