public void CanParseInstalledSdksPath() { // Given List <string> lines = @"Host (useful for support): Version: 2.1.0 Commit: caa7b7e2ba .NET Core SDKs installed: 2.1.200 [C:\Program Files\dotnet\sdk] 2.1.300 [C:\Program Files\dotnet\sdk] .NET Core runtimes installed: Microsoft.AspNetCore.All 2.1.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.App 2.1.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 1.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 1.0.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.0.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.1.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] To install additional .NET Core runtimes or SDKs: https://aka.ms/dotnet-download ".Split(System.Environment.NewLine).ToList(); // When string result = DotnetPathResolver.ParseInstalledSdksPath(lines); // Then result.ShouldBe(@"C:\Program Files\dotnet\sdk\2.1.300\"); }
public void CanParseInstalledSdksPath(string output, string sdksPath) { // Given List <string> lines = output.Split("\n").Select(x => x.Trim('\r')).ToList(); // When string result = DotnetPathResolver.ParseInstalledSdksPath(lines); // Then AnalyzerManager.NormalizePath(result).ShouldBe(AnalyzerManager.NormalizePath(sdksPath)); }