NUnit vs. MbUnit vs. MSTest vs. xUnit.net [closed]

I know this is an old thread, but I thought I’d post a vote for xUnit.NET. While most of the other testing frameworks mentioned are all pretty much the same, xUnit.NET has taken a pretty unique, modern, and flexible approach to unit testing. It changes terminology, so you no longer define TestFixtures and Tests…you specify … Read more

How do I get the path of the assembly the code is in?

Note: Assembly.CodeBase is deprecated in .NET Core/.NET 5+: https://docs.microsoft.com/en-us/dotnet/api/system.reflection.assembly.codebase?view=net-5.0 Original answer: I’ve defined the following property as we use this often in unit testing. public static string AssemblyDirectory { get { string codeBase = Assembly.GetExecutingAssembly().CodeBase; UriBuilder uri = new UriBuilder(codeBase); string path = Uri.UnescapeDataString(uri.Path); return Path.GetDirectoryName(path); } } The Assembly.Location property sometimes gives you some … Read more