dotnet-installer/test/EndToEnd/VersionTests.cs

34 lines
937 B
C#
Raw Normal View History

2018-11-20 18:17:29 +00:00
using System;
using System.IO;
using System.Linq;
using System.Xml.Linq;
using FluentAssertions;
using Microsoft.DotNet.TestFramework;
using Microsoft.DotNet.Tools.Test.Utilities;
using Xunit;
namespace EndToEnd.Tests
{
public class VersionTests : TestBase
{
[Fact]
public void DotnetVersionReturnsCorrectVersion()
{
var result = new DotnetCommand()
.ExecuteWithCapturedOutput("--version");
result.Should().Pass();
var dotnetFolder = Path.GetDirectoryName(RepoDirectoriesProvider.DotnetUnderTest);
var sdkFolders = Directory.GetDirectories(Path.Combine(dotnetFolder, "sdk"));
sdkFolders.Length.Should().Be(1, "Only one SDK folder is expected in the layout");
var expectedSdkVersion = Path.GetFileName(sdkFolders.Single());
result.StdOut.Trim().Should().Be(expectedSdkVersion);
}
}
}