Skip to content

Commit

Permalink
[dotnet] Change a list of downloadable files to IReadOnlyList (#13265)
Browse files Browse the repository at this point in the history
  • Loading branch information
nvborisenko authored Dec 7, 2023
1 parent b949dca commit 8e75d5d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions dotnet/src/webdriver/IHasDownloads.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ public interface IHasDownloads
/// <summary>
/// Retrieves the downloadable files.
/// </summary>
/// <returns>A list of file names available for download.</returns>
List<string> GetDownloadableFiles();
/// <returns>A read-only list of file names available for download.</returns>
IReadOnlyList<string> GetDownloadableFiles();

/// <summary>
/// Downloads a file with the specified file name and returns a dictionary containing the downloaded file's data.
Expand Down
6 changes: 3 additions & 3 deletions dotnet/src/webdriver/Remote/RemoteWebDriver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -471,10 +471,10 @@ public DevToolsSession GetDevToolsSession(int protocolVersion)
}

/// <summary>
/// Retrieves the downloadable files as a map of file names and their corresponding URLs.
/// Retrieves the downloadable files.
/// </summary>
/// <returns>A list containing file names as keys and URLs as values.</returns>
public List<string> GetDownloadableFiles()
/// <returns>A read-only list of file names available for download.</returns>
public IReadOnlyList<string> GetDownloadableFiles()
{
var enableDownloads = this.Capabilities.GetCapability(CapabilityType.EnableDownloads);
if (enableDownloads == null || !(bool) enableDownloads) {
Expand Down
6 changes: 3 additions & 3 deletions dotnet/test/common/DownloadsTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public void CanListDownloadableFiles()
{
DownloadWithBrowser();

List<string> names = ((RemoteWebDriver) driver).GetDownloadableFiles();
IReadOnlyList<string> names = ((RemoteWebDriver) driver).GetDownloadableFiles();
Assert.That(names, Contains.Item("file_1.txt"));
Assert.That(names, Contains.Item("file_2.jpg"));
}
Expand All @@ -52,7 +52,7 @@ public void CanDownloadFile()
{
DownloadWithBrowser();

List<string> names = ((RemoteWebDriver) driver).GetDownloadableFiles();
IReadOnlyList<string> names = ((RemoteWebDriver) driver).GetDownloadableFiles();
string fileName = names[0];
string targetDirectory = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());

Expand All @@ -72,7 +72,7 @@ public void CanDeleteFiles()

((RemoteWebDriver)driver).DeleteDownloadableFiles();

List<string> names = ((RemoteWebDriver) driver).GetDownloadableFiles();
IReadOnlyList<string> names = ((RemoteWebDriver) driver).GetDownloadableFiles();
Assert.IsEmpty(names, "The names list should be empty.");
}

Expand Down

0 comments on commit 8e75d5d

Please sign in to comment.