From d5f7efbe86f0117a1bf4836133eadd19952082c3 Mon Sep 17 00:00:00 2001 From: Livar Cunha Date: Wed, 23 Nov 2016 10:19:00 -0800 Subject: [PATCH] Addressing code review comments. --- src/Microsoft.DotNet.Cli.Utils/Muxer.cs | 3 +- test/EndToEnd/GivenDotNetUsesMSBuild.cs | 8 ++-- .../GivenAProjectToolsCommandResolver.cs | 42 +++++++++---------- 3 files changed, 26 insertions(+), 27 deletions(-) diff --git a/src/Microsoft.DotNet.Cli.Utils/Muxer.cs b/src/Microsoft.DotNet.Cli.Utils/Muxer.cs index 283f09770..cd1ef1e7e 100644 --- a/src/Microsoft.DotNet.Cli.Utils/Muxer.cs +++ b/src/Microsoft.DotNet.Cli.Utils/Muxer.cs @@ -15,7 +15,8 @@ namespace Microsoft.DotNet.Cli.Utils { get { - return new DirectoryInfo(Path.GetDirectoryName(GetDataFromAppDomain("FX_DEPS_FILE"))).Name; + var depsFile = new FileInfo(Path.GetDirectoryName(GetDataFromAppDomain("FX_DEPS_FILE"))); + return depsFile.Directory.Name; } } diff --git a/test/EndToEnd/GivenDotNetUsesMSBuild.cs b/test/EndToEnd/GivenDotNetUsesMSBuild.cs index 44389f598..b38396287 100644 --- a/test/EndToEnd/GivenDotNetUsesMSBuild.cs +++ b/test/EndToEnd/GivenDotNetUsesMSBuild.cs @@ -70,7 +70,7 @@ namespace Microsoft.DotNet.Tests.EndToEnd } [Fact] - public void ItCanRunToolsThatPrefersTheCliRuntime() + public void ItCanRunToolsThatPrefersTheCliRuntimeEvenWhenTheToolItselfDeclaresADifferentRuntime() { var testInstance = TestAssets.Get("MSBuildTestApp") .CreateInstance() @@ -82,10 +82,8 @@ namespace Microsoft.DotNet.Tests.EndToEnd new DotnetCommand() .WithWorkingDirectory(testInstance.Root) .ExecuteWithCapturedOutput("prefercliruntime") - .Should() - .Pass() - .And - .HaveStdOutContaining("Hello I prefer the cli runtime World!");; + .Should().Pass() + .And.HaveStdOutContaining("Hello I prefer the cli runtime World!");; } [Fact] diff --git a/test/Microsoft.DotNet.Cli.Utils.Tests/GivenAProjectToolsCommandResolver.cs b/test/Microsoft.DotNet.Cli.Utils.Tests/GivenAProjectToolsCommandResolver.cs index 9804ce7f2..26e8f281d 100644 --- a/test/Microsoft.DotNet.Cli.Utils.Tests/GivenAProjectToolsCommandResolver.cs +++ b/test/Microsoft.DotNet.Cli.Utils.Tests/GivenAProjectToolsCommandResolver.cs @@ -80,16 +80,16 @@ namespace Microsoft.DotNet.Tests { var projectToolsCommandResolver = SetupProjectToolsCommandResolver(); - var testInstance = TestAssetsManager - .CreateTestInstance(TestProjectName) - .WithNuGetMSBuildFiles() - .WithLockFiles(); + var testInstance = TestAssets.Get(TestProjectName) + .CreateInstance() + .WithSourceFiles() + .WithRestoreFiles(); var commandResolverArguments = new CommandResolverArguments() { CommandName = "nonexistent-command", CommandArguments = null, - ProjectDirectory = testInstance.Path + ProjectDirectory = testInstance.Root.FullName }; var result = projectToolsCommandResolver.Resolve(commandResolverArguments); @@ -102,16 +102,16 @@ namespace Microsoft.DotNet.Tests { var projectToolsCommandResolver = SetupProjectToolsCommandResolver(); - var testInstance = TestAssetsManager - .CreateTestInstance(TestProjectName) - .WithNuGetMSBuildFiles() - .WithLockFiles(); + var testInstance = TestAssets.Get(TestProjectName) + .CreateInstance() + .WithSourceFiles() + .WithRestoreFiles(); var commandResolverArguments = new CommandResolverArguments() { CommandName = "dotnet-portable", CommandArguments = null, - ProjectDirectory = testInstance.Path + ProjectDirectory = testInstance.Root.FullName }; var result = projectToolsCommandResolver.Resolve(commandResolverArguments); @@ -266,23 +266,23 @@ namespace Microsoft.DotNet.Tests { var projectToolsCommandResolver = SetupProjectToolsCommandResolver(); - var testInstance = TestAssetsManager - .CreateTestInstance("MSBuildTestApp") - .WithNuGetMSBuildFiles() - .WithLockFiles(); + var testInstance = TestAssets.Get("MSBuildTestApp") + .CreateInstance() + .WithSourceFiles() + .WithRestoreFiles(); var commandResolverArguments = new CommandResolverArguments() { CommandName = "dotnet-prefercliruntime", CommandArguments = null, - ProjectDirectory = testInstance.Path + ProjectDirectory = testInstance.Root.FullName }; var result = projectToolsCommandResolver.Resolve(commandResolverArguments); result.Should().NotBeNull(); - result.Args.Should().Contain("-fx-version 1.0.1"); + result.Args.Should().Contain("--fx-version 1.0.1"); } [Fact] @@ -290,16 +290,16 @@ namespace Microsoft.DotNet.Tests { var projectToolsCommandResolver = SetupProjectToolsCommandResolver(); - var testInstance = TestAssetsManager - .CreateTestInstance(TestProjectName) - .WithNuGetMSBuildFiles() - .WithLockFiles(); + var testInstance = TestAssets.Get(TestProjectName) + .CreateInstance() + .WithSourceFiles() + .WithRestoreFiles(); var commandResolverArguments = new CommandResolverArguments() { CommandName = "dotnet-portable", CommandArguments = null, - ProjectDirectory = testInstance.Path + ProjectDirectory = testInstance.Root.FullName }; var result = projectToolsCommandResolver.Resolve(commandResolverArguments);