Skip to content

Instantly share code, notes, and snippets.

@cpoDesign
Last active August 29, 2015 14:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cpoDesign/ba067924386bcb24a26e to your computer and use it in GitHub Desktop.
Save cpoDesign/ba067924386bcb24a26e to your computer and use it in GitHub Desktop.
Using embedded file. Create file in your project testingFile.xml. In properties set type as embedded resource file. How is your file called? http://blog.cpodesign.com/blog/how-is-my-file-called-in-resource/
var thisExe = System.Reflection.Assembly.GetExecutingAssembly();
string[] resources = thisExe.GetManifestResourceNames();
string list = "";
// Build the string of resources.
foreach (string resource in resources)
Console.WriteLine(resource);
class TestMapperTests
{
const string EmbeddedFile = "ProjectNameNamespace.testingFile.xml";
[Test]
public void LoadKmlData_ShouldImportThreeRecordsFromFile()
{
// Act
var mapper = new TestMapper();
var resourceStream = Assembly.GetExecutingAssembly().GetManifestResourceStream(EmbeddedFile);
var items = mapper.ParseReaderToDocument(resourceStream);
// Assert
Assert.AreEqual(3, items.Count);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment