public void GetSolutionRootDirectory_ResolvesSolutionRoot() { // Directory.GetCurrentDirectory() gives: // Testing\test\Microsoft.AspNetCore.Testing.Tests\bin\Debug\netcoreapp2.0 // Testing\test\Microsoft.AspNetCore.Testing.Tests\bin\Debug\net461 // Testing\test\Microsoft.AspNetCore.Testing.Tests\bin\Debug\net46 var expectedPath = Path.GetFullPath(Path.Combine(Directory.GetCurrentDirectory(), "..", "..", "..", "..", "..")); Assert.Equal(expectedPath, TestPathUtilities.GetSolutionRootDirectory("Extensions")); }
public void GetSolutionRootDirectory_Throws_IfNotFound() { var exception = Assert.Throws <Exception>(() => TestPathUtilities.GetSolutionRootDirectory("NotTesting")); Assert.Equal($"Solution file NotTesting.sln could not be found in {AppContext.BaseDirectory} or its parent directories.", exception.Message); }