dotnet-installer/test/dotnet-vstest.Tests/VSTestTests.cs
Faizan2304 b90b191ef0 Insert Microsoft.TestPlatform.cli for update3 preview1 (#6420)
* Fix test issue failing with PathTooLongIssue

(cherry picked from commit 340254f7742201c74ed1a5c349bdca89113bd5dc)

* fix for issues:
1) https://github.com/Microsoft/vstest/issues/755
2) https://github.com/Microsoft/vstest/issues/687
3) https://github.com/Microsoft/vstest/issues/737

(cherry picked from commit 0e93b2a5d4734637538781fa5401ed81a31eea0f)

* use new version

* Update version

* Fix pathtoolong issue

* Fix test
2017-05-02 21:30:51 -07:00

48 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.0")
.GetFile($"{testAppName}.dll");
var argsForVstest = $"\"{outputDll.FullName}\" --logger:console;verbosity=normal";
// Call vstest
var result = new VSTestCommand().ExecuteWithCapturedOutput(argsForVstest);
result.StdOut
.Should().Contain("Total tests: 2. Passed: 1. Failed: 1. Skipped: 0.")
.And.Contain("Passed TestNamespace.VSTestTests.VSTestPassTest")
.And.Contain("Failed TestNamespace.VSTestTests.VSTestFailTest");
result.ExitCode.Should().Be(1);
}
}
}