简体   繁体   中英

Convert DeploymentItem from MSTest to xUnit

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();
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM