Add tests to check the dependency tool load location.

This commit is contained in:
Sridhar Periyasamy 2016-04-06 11:52:48 -07:00
parent 1db2c08fb5
commit 71680d30aa
2 changed files with 7 additions and 4 deletions

View file

@ -1,4 +1,5 @@
using System; using System;
using System.Reflection;
namespace ConsoleApplication namespace ConsoleApplication
{ {
@ -11,7 +12,8 @@ namespace ConsoleApplication
#elif NETSTANDARD1_5 #elif NETSTANDARD1_5
Console.WriteLine($"Hello {string.Join(" ", args)} From .NETStandardApp,Version=v1.5"); Console.WriteLine($"Hello {string.Join(" ", args)} From .NETStandardApp,Version=v1.5");
#endif #endif
Console.WriteLine($"Base Directory - {AppContext.BaseDirectory}"); var currentAssemblyPath = typeof(ConsoleApplication.Program).GetTypeInfo().Assembly.Location;
Console.WriteLine($"Current Assembly Directory - {currentAssemblyPath}");
} }
} }
} }

View file

@ -44,9 +44,9 @@ namespace Microsoft.DotNet.Tests
// need conditional theories so we can skip on non-Windows // need conditional theories so we can skip on non-Windows
[Theory] [Theory]
[InlineData(".NETStandardApp,Version=v1.5", "CoreFX")] [InlineData(".NETStandardApp,Version=v1.5", "CoreFX", @"lib\netstandard1.5\dotnet-desktop-and-portable.dll")]
[InlineData(".NETFramework,Version=v4.5.1", "NetFX")] [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) public void TestFrameworkSpecificDependencyToolsCanBeInvoked(string framework, string args, string expectedDependencyToolPath)
{ {
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{ {
@ -65,6 +65,7 @@ namespace Microsoft.DotNet.Tests
result.Should().HaveStdOutContaining(framework); result.Should().HaveStdOutContaining(framework);
result.Should().HaveStdOutContaining(args); result.Should().HaveStdOutContaining(args);
result.Should().HaveStdOutContaining(expectedDependencyToolPath);
result.Should().NotHaveStdErr(); result.Should().NotHaveStdErr();
result.Should().Pass(); result.Should().Pass();
} }