Skip to content

Commit 8e75d5d

Browse files
authored
[dotnet] Change a list of downloadable files to IReadOnlyList (#13265)
1 parent b949dca commit 8e75d5d

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

dotnet/src/webdriver/IHasDownloads.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ public interface IHasDownloads
2828
/// <summary>
2929
/// Retrieves the downloadable files.
3030
/// </summary>
31-
/// <returns>A list of file names available for download.</returns>
32-
List<string> GetDownloadableFiles();
31+
/// <returns>A read-only list of file names available for download.</returns>
32+
IReadOnlyList<string> GetDownloadableFiles();
3333

3434
/// <summary>
3535
/// Downloads a file with the specified file name and returns a dictionary containing the downloaded file's data.

dotnet/src/webdriver/Remote/RemoteWebDriver.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -471,10 +471,10 @@ public DevToolsSession GetDevToolsSession(int protocolVersion)
471471
}
472472

473473
/// <summary>
474-
/// Retrieves the downloadable files as a map of file names and their corresponding URLs.
474+
/// Retrieves the downloadable files.
475475
/// </summary>
476-
/// <returns>A list containing file names as keys and URLs as values.</returns>
477-
public List<string> GetDownloadableFiles()
476+
/// <returns>A read-only list of file names available for download.</returns>
477+
public IReadOnlyList<string> GetDownloadableFiles()
478478
{
479479
var enableDownloads = this.Capabilities.GetCapability(CapabilityType.EnableDownloads);
480480
if (enableDownloads == null || !(bool) enableDownloads) {

dotnet/test/common/DownloadsTest.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public void CanListDownloadableFiles()
4141
{
4242
DownloadWithBrowser();
4343

44-
List<string> names = ((RemoteWebDriver) driver).GetDownloadableFiles();
44+
IReadOnlyList<string> names = ((RemoteWebDriver) driver).GetDownloadableFiles();
4545
Assert.That(names, Contains.Item("file_1.txt"));
4646
Assert.That(names, Contains.Item("file_2.jpg"));
4747
}
@@ -52,7 +52,7 @@ public void CanDownloadFile()
5252
{
5353
DownloadWithBrowser();
5454

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

@@ -72,7 +72,7 @@ public void CanDeleteFiles()
7272

7373
((RemoteWebDriver)driver).DeleteDownloadableFiles();
7474

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

0 commit comments

Comments
 (0)