Skip to content

Commit

Permalink
Fix SDK version test
Browse files Browse the repository at this point in the history
  • Loading branch information
JoeRobich committed Dec 14, 2020
1 parent 1f5e683 commit e3a38e8
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.1</TargetFramework>
</PropertyGroup>

</Project>
12 changes: 12 additions & 0 deletions test-assets/test-projects/NetCore31Project/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using System;

namespace ProjectAndSolution
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello World!");
}
}
}
5 changes: 5 additions & 0 deletions test-assets/test-projects/NetCore31Project/global.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"sdk": {
"version": "3.1.401"
}
}
18 changes: 15 additions & 3 deletions tests/OmniSharp.MSBuild.Tests/ProjectLoadListenerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -189,19 +189,31 @@ public async Task The_correct_project_capablities_is_emitted()
}

[Fact]
public async Task The_correct_sdk_version_is_emitted()
public async Task The_correct_sdk_version_is_emitted_NETCore2_1()
{
// Arrange
var emitter = new ProjectLoadTestEventEmitter();

using var testProject = await TestAssets.Instance.GetTestProjectAsync("NetCore21Project");
using var host = CreateMSBuildTestHost(testProject.Directory, emitter.AsExportDescriptionProvider(LoggerFactory));
Assert.Single(emitter.ReceivedMessages);
Assert.Equal(GetHashedFileExtension("3.1.403"), emitter.ReceivedMessages[0].SdkVersion);
Assert.Equal(GetHashedFileExtension("2.1.811"), emitter.ReceivedMessages[0].SdkVersion);
}

[Fact]
public async Task The_correct_sdk_version_is_emitted_2()
public async Task The_correct_sdk_version_is_emitted_NETCore3_1()
{
// Arrange
var emitter = new ProjectLoadTestEventEmitter();

using var testProject = await TestAssets.Instance.GetTestProjectAsync("NetCore31Project");
using var host = CreateMSBuildTestHost(testProject.Directory, emitter.AsExportDescriptionProvider(LoggerFactory));
Assert.Single(emitter.ReceivedMessages);
Assert.Equal(GetHashedFileExtension("3.1.401"), emitter.ReceivedMessages[0].SdkVersion);
}

[Fact]
public async Task The_correct_sdk_version_is_emitted_NET5()
{
// Arrange
var emitter = new ProjectLoadTestEventEmitter();
Expand Down

0 comments on commit e3a38e8

Please sign in to comment.