Skip to content

Commit

Permalink
Fix some more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nagilson committed Jun 22, 2022
1 parent 72cbfb5 commit 6241d52
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -427,24 +427,19 @@ public void It_fails_for_unsupported_rid()
public void It_publishes_on_release_if_PublishRelease_property_set()
{
var helloWorldAsset = _testAssetsManager
.CopyTestAsset("HelloWorld")
.WithSource()
.WithProjectChanges(project =>
{
var ns = project.Root.Name.Namespace;
var propertyGroup = new XElement(ns + "PropertyGroup");
project.Root.Add(propertyGroup);
propertyGroup.Add(new XElement(ns + "PublishRelease", "true"));
});
.CopyTestAsset("HelloWorld", "PackHelloWorld")
.WithSource();

System.IO.File.WriteAllText(helloWorldAsset.Path + "/Directory.Build.props", "<Project><PropertyGroup><PublishRelease>true</PublishRelease></PropertyGroup></Project>");

new BuildCommand(helloWorldAsset)
.Execute()
.Should()
.Pass();
.Execute()
.Should()
.Pass();

var packCommand = new PackCommand(Log, helloWorldAsset.TestRoot);
var publishCommand = new PublishCommand(Log, helloWorldAsset.TestRoot);

packCommand
publishCommand
.Execute()
.Should()
.HaveStdOutContaining("Release")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@ public class GivenDotnetPackInvocation : IClassFixture<NullCurrentSessionIdFixtu
{
const string ExpectedPrefix = "-maxcpucount -verbosity:m -restore -target:pack";
const string ExpectedNoBuildPrefix = "-maxcpucount -verbosity:m -target:pack";
const string ExpectedConfiguration = "-property:PackRelease=true";

private static readonly string WorkingDirectory =
private static readonly string WorkingDirectory =
TestPathUtilities.FormatAbsolutePath(nameof(GivenDotnetPackInvocation));

[Theory]
Expand Down Expand Up @@ -50,7 +49,7 @@ public void MsbuildInvocationIsCorrect(string[] args, string expectedAdditionalA
var expectedPrefix = args.FirstOrDefault() == "--no-build" ? ExpectedNoBuildPrefix : ExpectedPrefix;
command.SeparateRestoreCommand.Should().BeNull();
command.GetArgumentsToMSBuild().Should().Be($"{expectedPrefix} {ExpectedConfiguration}{expectedAdditionalArgs}");
command.GetArgumentsToMSBuild().Should().Be($"{expectedPrefix}{expectedAdditionalArgs}");
});
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ public GivenDotnetPublishInvocation(ITestOutputHelper output)
[InlineData(new string[] { "--verbosity", "minimal" }, "-verbosity:minimal")]
[InlineData(new string[] { "<project>" }, "<project>")]
[InlineData(new string[] { "<project>", "<extra-args>" }, "<project> <extra-args>")]
[InlineData(new string[] { "--disable-build-servers" }, "-p:UseRazorBuildServer=false -p:UseSharedCompilation=false /nodeReuse:false")]
public void MsbuildInvocationIsCorrect(string[] args, string expectedAdditionalArgs)
{
CommandDirectoryContext.PerformActionWithBasePath(WorkingDirectory, () =>
Expand All @@ -57,7 +56,7 @@ public void MsbuildInvocationIsCorrect(string[] args, string expectedAdditionalA
command.GetArgumentsToMSBuild()
.Should()
.Be($"{ExpectedPrefix} -restore -target:Publish {expectedAdditionalArgs}");
.Be($"{ExpectedPrefix} -restore -target:Publish{expectedAdditionalArgs}");
});
}

Expand All @@ -78,7 +77,7 @@ public void MsbuildInvocationIsCorrectForSeparateRestore(string[] args, string e

command.GetArgumentsToMSBuild()
.Should()
.Be($"{ExpectedPrefix} -nologo -target:Publish {expectedAdditionalArgs}");
.Be($"{ExpectedPrefix} -nologo -target:Publish{expectedAdditionalArgs}");
}

[Fact]
Expand Down

0 comments on commit 6241d52

Please sign in to comment.