Resolve Concelier/Excititor merge conflicts
This commit is contained in:
		@@ -0,0 +1,53 @@
 | 
			
		||||
namespace StellaOps.Scanner.Analyzers.Lang.Tests.TestUtilities;
 | 
			
		||||
 | 
			
		||||
public static class TestPaths
 | 
			
		||||
{
 | 
			
		||||
    public static string ResolveFixture(params string[] segments)
 | 
			
		||||
    {
 | 
			
		||||
        var baseDirectory = AppContext.BaseDirectory;
 | 
			
		||||
        var parts = new List<string> { baseDirectory };
 | 
			
		||||
        parts.AddRange(new[] { "Fixtures" });
 | 
			
		||||
        parts.AddRange(segments);
 | 
			
		||||
        return Path.GetFullPath(Path.Combine(parts.ToArray()));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public static string CreateTemporaryDirectory()
 | 
			
		||||
    {
 | 
			
		||||
        var root = Path.Combine(AppContext.BaseDirectory, "tmp", Guid.NewGuid().ToString("N"));
 | 
			
		||||
        Directory.CreateDirectory(root);
 | 
			
		||||
        return root;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public static void SafeDelete(string directory)
 | 
			
		||||
    {
 | 
			
		||||
        if (string.IsNullOrWhiteSpace(directory) || !Directory.Exists(directory))
 | 
			
		||||
        {
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        try
 | 
			
		||||
        {
 | 
			
		||||
            Directory.Delete(directory, recursive: true);
 | 
			
		||||
        }
 | 
			
		||||
        catch
 | 
			
		||||
        {
 | 
			
		||||
            // Swallow cleanup exceptions to avoid masking test failures.
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public static string ResolveProjectRoot()
 | 
			
		||||
    {
 | 
			
		||||
        var directory = AppContext.BaseDirectory;
 | 
			
		||||
        while (!string.IsNullOrEmpty(directory))
 | 
			
		||||
        {
 | 
			
		||||
            if (File.Exists(Path.Combine(directory, "StellaOps.Scanner.Analyzers.Lang.Tests.csproj")))
 | 
			
		||||
            {
 | 
			
		||||
                return directory;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            directory = Path.GetDirectoryName(directory) ?? string.Empty;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        throw new InvalidOperationException("Unable to locate project root.");
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user