Fixing dotnet-compile and dotnet-test unit tests. Also, fixing a potential NullRef in ProjectContext.

The compile unit test needed to be updated to mock out a new call to ICommand.WorkingDirectory.

The test unit test needed to account for build-base-path getting fully qualified.
This commit is contained in:
Eric Erhardt 2016-05-02 14:39:09 -05:00
parent 6249829e68
commit d52ea07934
3 changed files with 3 additions and 2 deletions

View file

@ -36,7 +36,7 @@ namespace Microsoft.DotNet.ProjectModel
public string RootDirectory => GlobalSettings?.DirectoryPath;
public string ProjectDirectory => ProjectFile.ProjectDirectory;
public string ProjectDirectory => ProjectFile?.ProjectDirectory;
public string PackagesDirectory { get; }

View file

@ -176,6 +176,7 @@ namespace Microsoft.DotNet.Tools.Compiler.Tests
var projectJson = Path.Combine(TestAssetPath, "project.json");
var command = new Mock<ICommand>();
command.Setup(c => c.Execute()).Returns(new CommandResult());
command.Setup(c => c.WorkingDirectory(It.IsAny<string>())).Returns(() => command.Object);
command.Setup(c => c.OnErrorLine(It.IsAny<Action<string>>())).Returns(() => command.Object);
command.Setup(c => c.OnOutputLine(It.IsAny<Action<string>>())).Returns(() => command.Object);
var commandFactory = new Mock<ICommandFactory>();

View file

@ -141,7 +141,7 @@ namespace Microsoft.Dotnet.Tools.Test.Tests
[Fact]
public void It_sets_BuildBasePath_when_one_is_passed_in()
{
_dotnetTestFullParams.BuildBasePath.Should().Be(BuildBasePath);
_dotnetTestFullParams.BuildBasePath.Should().Be(Path.GetFullPath(BuildBasePath));
}
[Fact]