Last active
August 29, 2015 14:04
-
-
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/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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