diff --git a/requirements.yaml b/requirements.yaml
index a139c2c..b12a41f 100644
--- a/requirements.yaml
+++ b/requirements.yaml
@@ -106,6 +106,7 @@ sections:
tests:
- Context_Create_LogFlag_OpensLogFile
- IntegrationTest_LogFlag_WritesOutputToFile
+ - IntegrationTest_LogFlag_WithInvalidFilename_ReturnsError
- id: NC-CLI-008
title: The tool shall cache NuGet packages specified as [package-name]:[version] arguments.
@@ -127,6 +128,7 @@ sections:
- Context_WriteError_SetsErrorExitCode
- Context_WriteError_NotSilent_WritesToConsole
- IntegrationTest_UnknownArgument_ReturnsError
+ - IntegrationTest_CacheNonexistentPackage_ReturnsError
- id: NC-CLI-010
title: The tool shall reject unknown or malformed command-line arguments with a descriptive error.
diff --git a/test/DemaConsulting.NuGet.CacheTool.Tests/IntegrationTests.cs b/test/DemaConsulting.NuGet.CacheTool.Tests/IntegrationTests.cs
index 3ea0437..7989349 100644
--- a/test/DemaConsulting.NuGet.CacheTool.Tests/IntegrationTests.cs
+++ b/test/DemaConsulting.NuGet.CacheTool.Tests/IntegrationTests.cs
@@ -268,4 +268,44 @@ public void IntegrationTest_CachePackage_OutputsPath()
Assert.IsFalse(string.IsNullOrWhiteSpace(output));
Assert.DoesNotContain("Error", output);
}
+
+ ///
+ /// Test that attempting to cache a nonexistent package returns an error.
+ ///
+ [TestMethod]
+ public void IntegrationTest_CacheNonexistentPackage_ReturnsError()
+ {
+ // Act
+ var exitCode = Runner.Run(
+ out var output,
+ "dotnet",
+ _dllPath,
+ "DemaConsulting.NonExistent.Package.XYZ:99.99.99");
+
+ // Assert
+ Assert.AreNotEqual(0, exitCode);
+ Assert.Contains("Error", output);
+ }
+
+ ///
+ /// Test that specifying an invalid log file path returns an error.
+ ///
+ [TestMethod]
+ public void IntegrationTest_LogFlag_WithInvalidFilename_ReturnsError()
+ {
+ // Arrange - use a hard-coded path into a nonexistent directory to ensure failure
+ const string invalidLogPath = "/nonexistent_dir_xyz_abc/invalid.log";
+
+ // Act
+ var exitCode = Runner.Run(
+ out var output,
+ "dotnet",
+ _dllPath,
+ "--log",
+ invalidLogPath);
+
+ // Assert
+ Assert.AreNotEqual(0, exitCode);
+ Assert.Contains("Error", output);
+ }
}