xamarin.android - Reading an asset in a Xamarin NUnit test class -


i want read mock rss feed file test against in xamarin nunit test android app. test class has no context can't put file in assets folder , this:

system.io.stream strin = instanceofassetmanager.open(feedfile); 

it has no ancestor, can't this:

system.io.stream strin = this.class.classloader.resourceasstream(feedfile); 

any suggestions how can jolly thing?

this case solved similar problem different platform/setup: storing test files in test project

the test class has no context can't put file in assets folder , this:

is there reason need use android assets? using .net embedded resources setting file's build action embeddedresource permits greater portability -- it's present on .net platforms -- , neatly sidesteps android context issue.

if need use android assets, can use android.app.application.context property, equivalent context.applicationcontext property, except static , available everywhere.


Comments

Popular posts from this blog

c++ - CryptStringToBinary API behavior -

c++ - Correct method for redrawing a layered window -

java.util.scanner - How to read and add only numbers to array from a text file -