public async Task HelloWorld_has_correct_property_values() { using (var host = CreateOmniSharpHost()) using (var testProject = await _testAssets.GetTestProjectAsync("HelloWorld")) { var projectFilePath = Path.Combine(testProject.Directory, "HelloWorld.csproj"); var projectFileInfo = CreateProjectFileInfo(host, testProject, projectFilePath); Assert.NotNull(projectFileInfo); Assert.Equal(projectFilePath, projectFileInfo.FilePath); var targetFramework = Assert.Single(projectFileInfo.TargetFrameworks); Assert.Equal("netcoreapp2.1", targetFramework); Assert.Equal("bin/Debug/netcoreapp2.1/", projectFileInfo.OutputPath.EnsureForwardSlashes()); Assert.Equal("obj/Debug/netcoreapp2.1/", projectFileInfo.IntermediateOutputPath.EnsureForwardSlashes()); Assert.Equal(3, projectFileInfo.SourceFiles.Length); // Program.cs, AssemblyInfo.cs, AssemblyAttributes.cs Assert.Equal(LanguageVersion.CSharp7_1, projectFileInfo.LanguageVersion); Assert.True(projectFileInfo.TreatWarningsAsErrors); Assert.Equal("Debug", projectFileInfo.Configuration); Assert.Equal("AnyCPU", projectFileInfo.Platform); var compilationOptions = projectFileInfo.CreateCompilationOptions(); Assert.Equal(ReportDiagnostic.Error, compilationOptions.GeneralDiagnosticOption); } }
public async Task HelloWorld_has_correct_property_values() { using (var host = CreateOmniSharpHost()) using (var testProject = await _testAssets.GetTestProjectAsync("HelloWorld")) { var projectFilePath = Path.Combine(testProject.Directory, "HelloWorld.csproj"); var projectFileInfo = ProjectFileInfo.Create(projectFilePath, testProject.Directory, GetSdksPath(host), this._logger); Assert.NotNull(projectFileInfo); Assert.Equal(projectFilePath, projectFileInfo.FilePath); Assert.Equal(1, projectFileInfo.TargetFrameworks.Length); Assert.Equal("netcoreapp1.0", projectFileInfo.TargetFrameworks[0]); Assert.Equal("bin/Debug/netcoreapp1.0/", projectFileInfo.OutputPath.Replace('\\', '/')); Assert.Equal(1, projectFileInfo.SourceFiles.Length); } }
public async Task HelloWorld_has_correct_property_values() { using (var host = CreateOmniSharpHost()) using (var testProject = await _testAssets.GetTestProjectAsync("HelloWorld")) { var projectFilePath = Path.Combine(testProject.Directory, "HelloWorld.csproj"); var projectFileInfo = CreateProjectFileInfo(host, testProject, projectFilePath); Assert.NotNull(projectFileInfo); Assert.Equal(projectFilePath, projectFileInfo.FilePath); Assert.Single(projectFileInfo.TargetFrameworks); Assert.Equal("netcoreapp1.0", projectFileInfo.TargetFrameworks[0]); Assert.Equal("bin/Debug/netcoreapp1.0/", projectFileInfo.OutputPath.Replace('\\', '/')); Assert.Equal(3, projectFileInfo.SourceFiles.Length); // Program.cs, AssemblyInfo.cs, AssemblyAttributes.cs Assert.Equal(LanguageVersion.CSharp7_1, projectFileInfo.LanguageVersion); } }
public async Task SingleResultExpect(string testSampleName, string projectName) { using (var testProject = await _testAssets.GetTestProjectAsync(testSampleName)) { var projectFilePath = ProjectSearcher.Search(testProject.Directory).Single(); Assert.Equal(projectName, GetLocation(testProject.BaseDirectory, projectFilePath)); } }