Moved analyzer tests to its own project

Also moves tests to `./test` which makes it possible
for all test projects to share the same .editorconfig
files and similar.
This commit is contained in:
Patrik Svensson
2021-06-23 22:47:12 +02:00
parent 721d73e9eb
commit c9b178ac96
307 changed files with 114 additions and 84 deletions

View File

@@ -0,0 +1,38 @@
using System;
using System.IO;
using System.Reflection;
namespace Spectre.Console.Tests
{
public static class EmbeddedResourceReader
{
public static Stream LoadResourceStream(string resourceName)
{
if (resourceName is null)
{
throw new ArgumentNullException(nameof(resourceName));
}
var assembly = Assembly.GetCallingAssembly();
resourceName = resourceName.Replace("/", ".");
return assembly.GetManifestResourceStream(resourceName);
}
public static Stream LoadResourceStream(Assembly assembly, string resourceName)
{
if (assembly is null)
{
throw new ArgumentNullException(nameof(assembly));
}
if (resourceName is null)
{
throw new ArgumentNullException(nameof(resourceName));
}
resourceName = resourceName.Replace("/", ".");
return assembly.GetManifestResourceStream(resourceName);
}
}
}