Monday, March 4, 2013

Windows 8 Unit testing: Include files in your test project

What can I say? Unit testing Windows 8 applications is a painful experience. It’s hard to apply mocking and some stuff is not easy to discover.

Last week I created a Windows 8 unit test that required a specific file to be available on the file system. So I added the file to my test project, changed the Build action to content and set Copy to output directory to Copy always.

But now the hard part what code should I use to read out the file from the file system?

That's it. Once you found it, it's actually not so difficult.

1 comment:

Buffy said...

Thanks man. I've spent ages searching exactly how to do this!