forked from dotnet/sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBundledTargetFramworkTests.cs
More file actions
40 lines (35 loc) · 1.22 KB
/
BundledTargetFramworkTests.cs
File metadata and controls
40 lines (35 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
#nullable disable
using Microsoft.DotNet.Cli;
using NuGet.Frameworks;
namespace Microsoft.DotNet.Tests
{
public class BundledTargetFrameworkTests : SdkTest
{
public BundledTargetFrameworkTests(ITestOutputHelper log) : base(log)
{
}
[Fact]
public void VersionCommandDisplaysCorrectVersion()
{
var filePath = Path.Combine(
AppContext.BaseDirectory,
"ExpectedTargetFrameworkMoniker.txt");
var targetFrameworkMoniker = GetTargetFrameworkMonikerFromFile(filePath);
var shortFolderName = NuGetFramework
.Parse(targetFrameworkMoniker)
.GetShortFolderName();
BundledTargetFramework
.GetTargetFrameworkMoniker()
.Should().Be(shortFolderName);
}
private static string GetTargetFrameworkMonikerFromFile(string versionFilePath)
{
using (var reader = new StreamReader(File.OpenRead(versionFilePath)))
{
return reader.ReadLine();
}
}
}
}