Skip to content

Commit 6d73ffa

Browse files
committed
fix a few more expectations
1 parent e7c60f3 commit 6d73ffa

File tree

5 files changed

+23
-28
lines changed

5 files changed

+23
-28
lines changed

test/dotnet-watch.Tests/CommandLineOptionsTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ public void ShortFormForLaunchProfileArgumentWorks()
424424
[InlineData(new[] { "--framework", "net9.0" }, new[] { "-property:TargetFramework=net9.0", NugetInteractiveProperty })]
425425
[InlineData(new[] { "--runtime", "arm64" }, new[] { "-property:RuntimeIdentifier=arm64", "-property:_CommandLineDefinedRuntimeIdentifier=true", NugetInteractiveProperty })]
426426
[InlineData(new[] { "--property", "b=1" }, new[] { "--property:b=1", NugetInteractiveProperty })]
427-
[InlineData(new[] { "--interactive" }, new[] { NugetInteractiveProperty })]
427+
[InlineData(new[] { "--interactive" }, new[] { "-property:NuGetInteractive=true" })]
428428
[InlineData(new[] { "--no-restore" }, new[] { NugetInteractiveProperty, "-restore:false" })]
429429
[InlineData(new[] { "--sc" }, new[] { NugetInteractiveProperty, "-property:SelfContained=True", "-property:_CommandLineDefinedSelfContained=true" })]
430430
[InlineData(new[] { "--self-contained" }, new[] { NugetInteractiveProperty, "-property:SelfContained=True", "-property:_CommandLineDefinedSelfContained=true" })]

test/dotnet.Tests/CommandTests/MSBuild/GivenDotnetPublishInvocation.cs

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ public GivenDotnetPublishInvocation(ITestOutputHelper output)
1919

2020
private static readonly string[] ExpectedPrefix = ["-maxcpucount", "-verbosity:m", "-tlp:default=auto", "-nologo"];
2121
private static readonly string[] ExpectedProperties = ["--property:_IsPublishing=true"];
22+
private static readonly string NuGetDisabledProperty = "-property:NuGetInteractive=false";
2223

2324
[Theory]
2425
[InlineData(new string[] { }, new string[] { })]
@@ -56,7 +57,7 @@ public void MsbuildInvocationIsCorrect(string[] args, string[] expectedAdditiona
5657

5758
command.GetArgumentTokensToMSBuild()
5859
.Should()
59-
.BeEquivalentTo([.. ExpectedPrefix, "-restore", "-target:Publish", .. ExpectedProperties, .. expectedAdditionalArgs]);
60+
.BeEquivalentTo([.. ExpectedPrefix, "-restore", "-target:Publish", .. ExpectedProperties, .. expectedAdditionalArgs, NuGetDisabledProperty]);
6061
});
6162
}
6263

@@ -68,14 +69,23 @@ public void MsbuildInvocationIsCorrectForSeparateRestore(string[] args, string[]
6869
var msbuildPath = "<msbuildpath>";
6970
var command = PublishCommand.FromArgs(args, msbuildPath);
7071

71-
command.SeparateRestoreCommand
72-
.GetArgumentTokensToMSBuild()
72+
var restoreTokens =
73+
command.SeparateRestoreCommand
74+
.GetArgumentTokensToMSBuild();
75+
output.WriteLine("restore tokens:");
76+
output.WriteLine(string.Join(" ", restoreTokens));
77+
restoreTokens
7378
.Should()
74-
.BeEquivalentTo([.. ExpectedPrefix, "-target:Restore", "-tlp:verbosity=quiet", .. ExpectedProperties]);
79+
.BeEquivalentTo([.. ExpectedPrefix, "-target:Restore", "-tlp:verbosity=quiet", .. ExpectedProperties, NuGetDisabledProperty]);
7580

76-
command.GetArgumentTokensToMSBuild()
81+
var buildTokens =
82+
command.GetArgumentTokensToMSBuild();
83+
output.WriteLine("build tokens:");
84+
output.WriteLine(string.Join(" ", buildTokens));
85+
86+
buildTokens
7787
.Should()
78-
.BeEquivalentTo([.. ExpectedPrefix, "-nologo", "-target:Publish", .. ExpectedProperties, .. expectedAdditionalArgs]);
88+
.BeEquivalentTo([.. ExpectedPrefix, "-nologo", "-target:Publish", .. ExpectedProperties, .. expectedAdditionalArgs, NuGetDisabledProperty]);
7989
}
8090

8191
[Fact]
@@ -90,7 +100,7 @@ public void MsbuildInvocationIsCorrectForNoBuild()
90100

91101
command.GetArgumentTokensToMSBuild()
92102
.Should()
93-
.BeEquivalentTo([.. ExpectedPrefix, "-target:Publish", .. ExpectedProperties, "-property:NoBuild=true"]);
103+
.BeEquivalentTo([.. ExpectedPrefix, "-target:Publish", .. ExpectedProperties, "-property:NoBuild=true", NuGetDisabledProperty]);
94104
}
95105

96106
[Fact]
@@ -101,7 +111,7 @@ public void CommandAcceptsMultipleCustomProperties()
101111

102112
command.GetArgumentTokensToMSBuild()
103113
.Should()
104-
.BeEquivalentTo([.. ExpectedPrefix, "-restore", "-target:Publish", .. ExpectedProperties, "--property:Prop1=prop1", "--property:Prop2=prop2"]);
114+
.BeEquivalentTo([.. ExpectedPrefix, "-restore", "-target:Publish", .. ExpectedProperties, "--property:Prop1=prop1", "--property:Prop2=prop2", NuGetDisabledProperty]);
105115
}
106116
}
107117
}

test/dotnet.Tests/CommandTests/MSBuild/GivenDotnetRestoreInvocation.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ namespace Microsoft.DotNet.Cli.MSBuild.Tests
99
public class GivenDotnetRestoreInvocation : IClassFixture<NullCurrentSessionIdFixture>
1010
{
1111
private static readonly string[] ExpectedPrefix = ["-maxcpucount", "-verbosity:m", "-tlp:default=auto", "-nologo", "-target:Restore"];
12+
private static readonly string NuGetDisabledProperty = "-property:NuGetInteractive=false";
1213
private static readonly string WorkingDirectory =
1314
TestPathUtilities.FormatAbsolutePath(nameof(GivenDotnetRestoreInvocation));
1415

@@ -49,7 +50,7 @@ public void MsbuildInvocationIsCorrect(string[] args, string[] expectedAdditiona
4950
RestoreCommand.FromArgs(args, msbuildPath)
5051
.GetArgumentTokensToMSBuild()
5152
.Should()
52-
.BeEquivalentTo([.. ExpectedPrefix, .. expectedAdditionalArgs]);
53+
.BeEquivalentTo([.. ExpectedPrefix, .. expectedAdditionalArgs, NuGetDisabledProperty]);
5354
});
5455
}
5556
}

test/dotnet.Tests/CommandTests/MSBuild/GivenDotnetRunInvocation.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ namespace Microsoft.DotNet.Cli.MSBuild.Tests
99
public class GivenDotnetRunInvocation : IClassFixture<NullCurrentSessionIdFixture>
1010
{
1111
private static readonly string[] ConstantRestoreArgs = ["-nologo", "-verbosity:quiet"];
12+
private static readonly string NuGetDisabledProperty = "-property:NuGetInteractive=false";
1213

1314
public ITestOutputHelper Log { get; }
1415

@@ -41,7 +42,7 @@ public void MsbuildInvocationIsCorrect(string[] args, string[] expectedArgs)
4142
var command = RunCommand.FromArgs(args);
4243
command.RestoreArgs
4344
.Should()
44-
.BeEquivalentTo([.. ConstantRestoreArgs, .. expectedArgs]);
45+
.BeEquivalentTo([.. ConstantRestoreArgs, .. expectedArgs, NuGetDisabledProperty]);
4546
});
4647
}
4748
finally

test/dotnet.Tests/CommandTests/Run/GivenDotnetRunBuildsCsProj.cs

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -697,23 +697,6 @@ public void ItRunsWithTheSpecifiedVerbosity()
697697
}
698698
}
699699

700-
[Fact]
701-
public void ItDoesShowImportantLevelMessageByDefault()
702-
{
703-
var testAppName = "MSBuildTestApp";
704-
var testInstance = _testAssetsManager.CopyTestAsset(testAppName)
705-
.WithSource()
706-
.WithProjectChanges(ProjectModification.AddDisplayMessageBeforeRestoreToProject);
707-
708-
var result = new DotnetCommand(Log, "run")
709-
.WithWorkingDirectory(testInstance.Path)
710-
.Execute();
711-
712-
// this message should show because interactivity (and therefore nuget auth) is the default
713-
result.Should().Pass()
714-
.And.HaveStdOutContaining("Important text");
715-
}
716-
717700
[Fact]
718701
public void ItDoesNotShowImportantLevelMessageByDefaultWhenInteractivityDisabled()
719702
{

0 commit comments

Comments
 (0)