Skip to content

Commit

Permalink
SolutionTests: Check if SDK version is installed and if not ignore th…
Browse files Browse the repository at this point in the history
…e test (#266)
  • Loading branch information
obligaron authored Oct 1, 2024
1 parent 44078a1 commit 156055b
Showing 1 changed file with 16 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,26 +27,33 @@ public void CreateEmptySolution()
}


[Theory]
[SkippableTheory]
[InlineData(ProgrammingLanguage.CSharp, "csproj")]
[InlineData(ProgrammingLanguage.FSharp, "fsproj")]
[InlineData(ProgrammingLanguage.VB, "vbproj")]

public void CreateSolutionWithProject(ProgrammingLanguage programmingLanguage, string expectedEnding)
{
string folder = Path.Combine(Path.GetTempPath(), "Reqnroll.TestProjectGenerator.Tests", Guid.NewGuid().ToString("N"));
try
{
string folder = Path.Combine(Path.GetTempPath(), "Reqnroll.TestProjectGenerator.Tests", Guid.NewGuid().ToString("N"));

var solution = new Solution("SolutionName");
var project = new Project("ProjectName", Guid.NewGuid(), programmingLanguage, TargetFramework.Net462, ProjectFormat.New);
var solution = new Solution("SolutionName");
var project = new Project("ProjectName", Guid.NewGuid(), programmingLanguage, TargetFramework.Net462, ProjectFormat.New);

solution.AddProject(project);
solution.AddProject(project);

var solutionWriter = CreateSolutionWriter();
var solutionWriter = CreateSolutionWriter();

solutionWriter.WriteToFileSystem(solution, folder);
solutionWriter.WriteToFileSystem(solution, folder);

File.Exists(Path.Combine(folder, "SolutionName.sln")).Should().BeTrue();
File.Exists(Path.Combine(folder, "ProjectName", $"ProjectName.{expectedEnding}")).Should().BeTrue();
File.Exists(Path.Combine(folder, "SolutionName.sln")).Should().BeTrue();
File.Exists(Path.Combine(folder, "ProjectName", $"ProjectName.{expectedEnding}")).Should().BeTrue();
}
catch (DotNetSdkNotInstalledException ex)
{
Skip.IfNot(new ConfigurationDriver().PipelineMode, ex.ToString());
}
}
}
}

0 comments on commit 156055b

Please sign in to comment.