I am writing some unit tests in which I need a fake xml file. I can create that file and require it to be deployed with the unit tests, but experience shows that at my office it's a lot of headache. So I decided that the file will be created by UT's.
StreamWriter sw = new StreamWriter(testFileName);
sw.Write(contents);
sw.Close();
Now the problem is the contents string. It is virtually a long xml, something like this:
string contents =
@"<?xml version="1.0" encoding="windows-1251"?>
<blah>
~100 lines here
</blah> ";
I don't want this to be in the same file as the rest of the code. I want the string to be generated compile-time from a file.
In C++, I'd do this
string contents = "
#include "test.xml"
";
Is it possible somehow in C#?
Why don't you include it in a resource?