Skip to content

Commit e9d6d70

Browse files
committed
Fix test string format
1 parent 7c86837 commit e9d6d70

File tree

5 files changed

+11
-15
lines changed

5 files changed

+11
-15
lines changed

test/dotnet.Tests/CommandTests/Tool/Install/ToolInstallLocalCommandTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,10 +168,10 @@ public void GivenNoManifestFileItShouldThrowAndContainNoManifestGuide()
168168

169169
a.Should().Throw<GracefulException>()
170170
.And.Message.Should()
171-
.Contain(CliStrings.CannotFindAManifestFile);
171+
.Contain(string.Format(CliStrings.CannotFindAManifestFile, ""));
172172

173173
a.Should().Throw<GracefulException>()
174-
.And.VerboseMessage.Should().Contain(CliStrings.CannotFindAManifestFile.Substring(0, 25));
174+
.And.VerboseMessage.Should().Contain(string.Format(CliStrings.CannotFindAManifestFile, ""));
175175
}
176176

177177
[Fact]

test/dotnet.Tests/CommandTests/Tool/Restore/ToolRestoreCommandTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ public void WhenCannotFindManifestFileItPrintsWarning()
452452

453453
_reporter.Lines.Should()
454454
.Contain(l =>
455-
l.Contains(CliStrings.CannotFindAManifestFile));
455+
l.Contains(string.Format(CliStrings.CannotFindAManifestFile, "")));
456456
}
457457

458458
[Fact]

test/dotnet.Tests/CommandTests/Tool/Uninstall/ToolUninstallLocalCommandTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public void GivenNoManifestFileItShouldThrow()
6969

7070
a.Should().Throw<GracefulException>()
7171
.And.Message.Should()
72-
.Contain(CliStrings.CannotFindAManifestFile);
72+
.Contain(string.Format(CliStrings.CannotFindAManifestFile, ""));
7373

7474
a.Should().Throw<GracefulException>()
7575
.And.VerboseMessage.Should().Contain(string.Format(CliStrings.CannotFindAManifestFile, ""));

test/dotnet.Tests/CommandTests/Tool/Update/ToolUpdateLocalCommandTests.cs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -237,12 +237,8 @@ public void GivenNoManifestFileItShouldThrow()
237237
_fileSystem.File.Delete(_manifestFilePath);
238238
Action a = () => _defaultToolUpdateLocalCommand.Execute().Should().Be(0);
239239

240-
a.Should().Throw<GracefulException>()
241-
.And.Message.Should()
242-
.Contain(CliStrings.CannotFindAManifestFile);
243-
244-
a.Should().Throw<GracefulException>()
245-
.And.VerboseMessage.Should().Contain(string.Format(CliStrings.CannotFindAManifestFile, ""));
240+
a.Should().Throw<ToolManifestCannotBeFoundException>().And.VerboseMessage.Should()
241+
.Contain(string.Format(CliStrings.CannotFindAManifestFile, ""));
246242
}
247243

248244
[Fact]

test/dotnet.Tests/ToolManifestTests/ToolManifestFinderTests.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ public void GivenManifestFileInRootDirectoryItThrowsError()
148148
Action a = () => toolManifest.Find();
149149

150150
a.Should().Throw<ToolManifestCannotBeFoundException>().And.Message.Should()
151-
.Contain(CliStrings.CannotFindAManifestFile);
151+
.Contain(string.Format(CliStrings.CannotFindAManifestFile, ""));
152152
}
153153

154154
[PlatformSpecificFact(TestPlatforms.Windows)]
@@ -254,7 +254,7 @@ public void WhenCalledWithNonExistsFilePathItThrows()
254254

255255
Action a = () => toolManifest.Find(new FilePath(Path.Combine(_testDirectoryRoot, "non-exists")));
256256
a.Should().Throw<ToolManifestCannotBeFoundException>().And.Message.Should()
257-
.Contain(CliStrings.CannotFindAManifestFile);
257+
.Contain(string.Format(CliStrings.CannotFindAManifestFile, ""));
258258

259259
a.Should().Throw<ToolManifestCannotBeFoundException>().And.VerboseMessage.Should()
260260
.Contain(string.Format(CliStrings.CannotFindAManifestFile, ""))
@@ -274,7 +274,7 @@ public void GivenNoManifestFileItThrows()
274274

275275
Action a = () => toolManifest.Find();
276276
a.Should().Throw<ToolManifestCannotBeFoundException>().And.Message.Should()
277-
.Contain(CliStrings.CannotFindAManifestFile);
277+
.Contain(string.Format(CliStrings.CannotFindAManifestFile, ""));
278278

279279
a.Should().Throw<ToolManifestCannotBeFoundException>().And.VerboseMessage.Should()
280280
.Contain(string.Format(CliStrings.CannotFindAManifestFile, ""));
@@ -444,7 +444,7 @@ public void GivenNoManifestFileWhenFindContainPackageIdItThrows()
444444
Action a = () => toolManifest.FindByPackageId(new PackageId("t-rex"));
445445

446446
a.Should().Throw<ToolManifestCannotBeFoundException>().And.Message.Should()
447-
.Contain(CliStrings.CannotFindAManifestFile);
447+
.Contain(string.Format(CliStrings.CannotFindAManifestFile, ""));
448448

449449
a.Should().Throw<ToolManifestCannotBeFoundException>().And.VerboseMessage.Should()
450450
.Contain(string.Format(CliStrings.CannotFindAManifestFile, ""));
@@ -740,7 +740,7 @@ public void GivenManifestFileOnSameDirectoryItThrowsWhenTheManifestFileCannotBeF
740740
Action a = () => toolManifest.FindFirst();
741741

742742
a.Should().Throw<ToolManifestCannotBeFoundException>().And.Message.Should()
743-
.Contain(CliStrings.CannotFindAManifestFile);
743+
.Contain(string.Format(CliStrings.CannotFindAManifestFile, ""));
744744

745745
a.Should().Throw<ToolManifestCannotBeFoundException>().And.VerboseMessage.Should()
746746
.Contain(string.Format(CliStrings.CannotFindAManifestFile, ""));

0 commit comments

Comments
 (0)