From 71680d30aa760d15ffaede5d3a4cf0a226d448e0 Mon Sep 17 00:00:00 2001 From: Sridhar Periyasamy Date: Wed, 6 Apr 2016 11:52:48 -0700 Subject: [PATCH] Add tests to check the dependency tool load location. --- .../TestPackages/dotnet-desktop-and-portable/Program.cs | 4 +++- test/dotnet.Tests/PackagedCommandTests.cs | 7 ++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/TestAssets/TestPackages/dotnet-desktop-and-portable/Program.cs b/TestAssets/TestPackages/dotnet-desktop-and-portable/Program.cs index 0e67613a0..d824a4c3a 100644 --- a/TestAssets/TestPackages/dotnet-desktop-and-portable/Program.cs +++ b/TestAssets/TestPackages/dotnet-desktop-and-portable/Program.cs @@ -1,4 +1,5 @@ using System; +using System.Reflection; namespace ConsoleApplication { @@ -11,7 +12,8 @@ namespace ConsoleApplication #elif NETSTANDARD1_5 Console.WriteLine($"Hello {string.Join(" ", args)} From .NETStandardApp,Version=v1.5"); #endif - Console.WriteLine($"Base Directory - {AppContext.BaseDirectory}"); + var currentAssemblyPath = typeof(ConsoleApplication.Program).GetTypeInfo().Assembly.Location; + Console.WriteLine($"Current Assembly Directory - {currentAssemblyPath}"); } } } diff --git a/test/dotnet.Tests/PackagedCommandTests.cs b/test/dotnet.Tests/PackagedCommandTests.cs index cdda94343..3a3c6023f 100644 --- a/test/dotnet.Tests/PackagedCommandTests.cs +++ b/test/dotnet.Tests/PackagedCommandTests.cs @@ -44,9 +44,9 @@ namespace Microsoft.DotNet.Tests // need conditional theories so we can skip on non-Windows [Theory] - [InlineData(".NETStandardApp,Version=v1.5", "CoreFX")] - [InlineData(".NETFramework,Version=v4.5.1", "NetFX")] - public void TestFrameworkSpecificDependencyToolsCanBeInvoked(string framework, string args) + [InlineData(".NETStandardApp,Version=v1.5", "CoreFX", @"lib\netstandard1.5\dotnet-desktop-and-portable.dll")] + [InlineData(".NETFramework,Version=v4.5.1", "NetFX", @"AppWithDirectDependencyDesktopAndPortable\bin\Debug\net451\win7-x64\dotnet-desktop-and-portable.exe")] + public void TestFrameworkSpecificDependencyToolsCanBeInvoked(string framework, string args, string expectedDependencyToolPath) { if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { @@ -65,6 +65,7 @@ namespace Microsoft.DotNet.Tests result.Should().HaveStdOutContaining(framework); result.Should().HaveStdOutContaining(args); + result.Should().HaveStdOutContaining(expectedDependencyToolPath); result.Should().NotHaveStdErr(); result.Should().Pass(); }