Skip to content

Commit 9973ff0

Browse files
committed
Update Tests
- We dont need two tests showing it should throw, and then it should throw with a message. Kept only the 2nd test. - Modified the we should throw test to only expect throw if create manifest if needed is false since the default is now true.
1 parent 6c059f9 commit 9973ff0

File tree

1 file changed

+13
-16
lines changed

1 file changed

+13
-16
lines changed

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

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -127,23 +127,22 @@ public void WhenRunWithPackageIdItShouldSaveToCacheAndAddToManifestFile()
127127
AssertDefaultInstallSuccess();
128128
}
129129

130-
[Fact]
131-
public void GivenNoManifestFileItShouldThrow()
132-
{
133-
_fileSystem.File.Delete(_manifestFilePath);
134-
var toolInstallLocalCommand = GetDefaultTestToolInstallLocalCommand();
135-
136-
Action a = () => toolInstallLocalCommand.Execute();
137-
a.Should().Throw<GracefulException>()
138-
.And.Message.Should()
139-
.Contain(CliStrings.CannotFindAManifestFile);
140-
}
141-
142130
[Fact]
143131
public void GivenNoManifestFileItShouldThrowAndContainNoManifestGuide()
144132
{
145133
_fileSystem.File.Delete(_manifestFilePath);
146-
var toolInstallLocalCommand = GetDefaultTestToolInstallLocalCommand();
134+
ParseResult parseResult =
135+
Parser.Instance.Parse(
136+
$"dotnet tool install {_packageIdA.ToString()} --create-manifest-if-needed=false");
137+
138+
var toolInstallLocalCommand = new ToolInstallLocalCommand(
139+
parseResult,
140+
_packageIdA,
141+
_toolPackageDownloaderMock,
142+
_toolManifestFinder,
143+
_toolManifestEditor,
144+
_localToolsResolverCache,
145+
_reporter);
147146

148147
Action a = () => toolInstallLocalCommand.Execute();
149148
a.Should().Throw<GracefulException>()
@@ -417,11 +416,9 @@ public void GivenNoManifestFileItUsesCreateManifestIfNeededByDefault()
417416
Parser.Instance.Parse(
418417
$"dotnet tool install {_packageIdA.ToString()}");
419418

420-
421419
var installLocalCommand = new ToolInstallLocalCommand(
422420
parseResult,
423-
_packageIdA,
424-
_toolPackageDownloaderMock,
421+
_toolPackageInstallerMock,
425422
_toolManifestFinder,
426423
_toolManifestEditor,
427424
_localToolsResolverCache,

0 commit comments

Comments
 (0)