I'm migrating MSTest cases to XUnit and couldn't find a way to convert DeploymentItem attribute of MSUnit to equivalent in XUnit. Please let me know how to migrate it.
[DeploymentItem("Test Data", "Certificates")]
Thanks in advance.
I'm migrating MSTest cases to XUnit and couldn't find a way to convert DeploymentItem attribute of MSUnit to equivalent in XUnit. Please let me know how to migrate it.
[DeploymentItem("Test Data", "Certificates")]
Thanks in advance.
XUnit creators suggest using embedded resources as there is no equivalent
You can find some details how to read embedded resources in other questions. Here is one of them:
var assembly = Assembly.GetExecutingAssembly();
var resourceName = "MyCompany.MyProduct.MyFile.txt";
using (Stream stream = assembly.GetManifestResourceStream(resourceName))
using (StreamReader reader = new StreamReader(stream))
{
string result = reader.ReadToEnd();
}