add more unit tests

This commit is contained in:
Krzysztof Wicher 2017-02-14 11:38:01 -08:00
commit 8ebc06da46
4 changed files with 28 additions and 24 deletions

View file

@ -1,21 +1,21 @@
using Microsoft.DotNet.Tools.Build;
using System;
using System.Collections.Generic;
using System.Text;
using FluentAssertions;
using Xunit;
using System.IO;
namespace Microsoft.DotNet.Cli.MSBuild.Tests
{
public class GivenDotnetBuildInvocation
{
[Fact]
public void WhenNoArgsArePassedThenMsbuildInvocationIsCorrect()
[Theory]
[InlineData(new string[] { }, @"exec <msbuildpath> /m /v:m /t:Build /clp:Summary")]
[InlineData(new string[] { "-o", "foo" }, @"exec <msbuildpath> /m /v:m /t:Build /p:OutputPath=foo /clp:Summary")]
[InlineData(new string[] { "--output", "foo" }, @"exec <msbuildpath> /m /v:m /t:Build /p:OutputPath=foo /clp:Summary")]
[InlineData(new string[] { "-o", "foo1 foo2" }, @"exec <msbuildpath> /m /v:m /t:Build ""/p:OutputPath=foo1 foo2"" /clp:Summary")]
public void WhenNoArgsArePassedThenMsbuildInvocationIsCorrect(string[] args, string expectedCommand)
{
var msbuildPath = Path.Combine(Directory.GetCurrentDirectory(), "MSBuild.dll");
BuildCommand.FromArgs()
.GetProcessStartInfo().Arguments.Should().Be($@"exec {msbuildPath} /m /v:m /t:Build /clp:Summary");
var msbuildPath = "<msbuildpath>";
BuildCommand.FromArgs(args, msbuildPath)
.GetProcessStartInfo().Arguments.Should().Be(expectedCommand);
}
}
}