Live Unit Testing with embedded ressources


February 2019


6 time


I have a test using a embedded ressource to check. If i'm executing the test manually, everything works fine. I print all available ressources on startup.

Manually executed:

Available Ressources:

If the same test is excecuted by the live unit testing, an error appears and the output is:

Available Ressources:

Anybody an idea how to fix this, I'd love to make live unit testing with embedded ressources.

Method to get the ressource

    var assembly = Assembly.GetExecutingAssembly();

    string result;
    using (var stream = assembly.GetManifestResourceStream(resourceName)) 
    //at live unit-testing, a null reference exception appears while getting the stream
    using (var reader = new StreamReader(stream))
        result = reader.ReadToEnd();
    return result;

0 answers