Adding resource file for testing in Rider

I have started to use rider for developing in Linux with C#. I have created my tests like:

namespace RAWConverter
{

    using NUnit.Framework;

    [TestFixture]
    public class SerializationHelperTest
    {

        [Test]
        public void SerializeEntry()
        {
            msRun msRun = new msRun();
            SerializationHelper.SerializationEntry(System.IO.Path.GetTempFileName(), msRun);
        }

        [Test]
        public void DeserializationEntry()
        {
            msRun msRun = SerializationHelper.DeserializationEntry(getFileNameFromResource(RAWConverter.Properties.));
            Console.WriteLine(msRun.endTime);
        }

        private string getFileNameFromResource(String fileName)
        {
            String strAppPath = Path.GetDirectoryName(System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName);
            String strFilePath = Path.Combine(strAppPath, "resources");
            return Path.Combine(strFilePath, fileName);
        }

    }
}

and I have a folder in my project called resources that contains the file. However when I execute my tests it fail because this variable

System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName

is in /usr/bin

Any ideas?

Please sign in to leave a comment.