dotnet-installer/test/dotnet-vstest.Tests/VSTestTests.cs
Livar Cunha e1916cc4dc Merge remote-tracking branch 'dotnet/release/15.5' into merges/release/15.5-to-master-20171016-070031
* dotnet/release/15.5: (21 commits)
  Manually merging some changes that git merged wrong and deleted from the 15.5 branch.
  Separating the 'legacy' URL construction from the 'current' URL construction methods and logic.
  Use temporary path for fake deps.json in test
  Use same build number for roslyn and F# satellites
  Updating Roslyn satellites and SDK versions
  Insert NuGet Build 4.5.0-preview2-4529 into cli
  Update NuGet to 4529 (signed)
  MSBuild 15.5.154
  MSBuild 15.5.153
  removed commented out config I'd meant to remove
  added a way to specify the asp.net template versions
  Porting 'dotnet-install.sh' from CLI:master to CLI:release/2.0.0
  'NuGet.master.config' does not appear to be used.
  Fixed tests
  Update branch info to release/15.5
  Updating the websdk version to 2.0.0-rel-20171010-665
  Insert NuGet Build 4.5.0-preview1-4526 into cli
  Update DependencyVersions.props
  Updated version of TestPlatform to 15.5.0-preview-20170923-02
  MSBuild 15.4.8
  ...
2017-10-16 15:42:40 -07:00

52 lines
1.7 KiB
C#

// Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using Microsoft.DotNet.Tools.Test.Utilities;
using Xunit;
using System;
using System.IO;
using FluentAssertions;
using Microsoft.DotNet.TestFramework;
using Microsoft.DotNet.Cli.Utils;
namespace Microsoft.DotNet.Cli.VSTest.Tests
{
public class VSTestTests : TestBase
{
[Fact]
public void TestsFromAGivenContainerShouldRunWithExpectedOutput()
{
var testAppName = "VSTestCore";
var testRoot = TestAssets.Get(testAppName)
.CreateInstance()
.WithSourceFiles()
.WithRestoreFiles()
.Root;
var configuration = Environment.GetEnvironmentVariable("CONFIGURATION") ?? "Debug";
new BuildCommand()
.WithWorkingDirectory(testRoot)
.Execute()
.Should().Pass();
var outputDll = testRoot
.GetDirectory("bin", configuration, "netcoreapp2.1")
.GetFile($"{testAppName}.dll");
var argsForVstest = $"\"{outputDll.FullName}\" --logger:console;verbosity=normal";
// Call vstest
var result = new VSTestCommand().ExecuteWithCapturedOutput(argsForVstest);
if (!DotnetUnderTest.IsLocalized())
{
result.StdOut
.Should().Contain("Total tests: 2. Passed: 1. Failed: 1. Skipped: 0.")
.And.Contain("Passed VSTestPassTest")
.And.Contain("Failed VSTestFailTest");
}
result.ExitCode.Should().Be(1);
}
}
}