Skip to content

Commit 3d15087

Browse files
[dotnet] [bidi] Remove IEnumerable of command results (#16219)
Co-authored-by: Michael Render <render.michael@gmail.com>
1 parent e6d99a3 commit 3d15087

20 files changed

+81
-467
lines changed

dotnet/src/webdriver/BiDi/Browser/GetClientWindowsCommand.cs

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,7 @@
1818
// </copyright>
1919

2020
using OpenQA.Selenium.BiDi.Communication;
21-
using OpenQA.Selenium.BiDi.Communication.Json.Converters.Enumerable;
22-
using System.Collections;
2321
using System.Collections.Generic;
24-
using System.Text.Json.Serialization;
2522

2623
namespace OpenQA.Selenium.BiDi.Browser;
2724

@@ -30,21 +27,4 @@ internal sealed class GetClientWindowsCommand()
3027

3128
public sealed class GetClientWindowsOptions : CommandOptions;
3229

33-
[JsonConverter(typeof(GetClientWindowsResultConverter))]
34-
public sealed record GetClientWindowsResult : EmptyResult, IReadOnlyList<ClientWindowInfo>
35-
{
36-
internal GetClientWindowsResult(IReadOnlyList<ClientWindowInfo> clientWindows)
37-
{
38-
ClientWindows = clientWindows;
39-
}
40-
41-
public IReadOnlyList<ClientWindowInfo> ClientWindows { get; }
42-
43-
public ClientWindowInfo this[int index] => ClientWindows[index];
44-
45-
public int Count => ClientWindows.Count;
46-
47-
public IEnumerator<ClientWindowInfo> GetEnumerator() => ClientWindows.GetEnumerator();
48-
49-
IEnumerator IEnumerable.GetEnumerator() => (ClientWindows as IEnumerable).GetEnumerator();
50-
}
30+
public sealed record GetClientWindowsResult(IReadOnlyList<ClientWindowInfo> ClientWindows) : EmptyResult;

dotnet/src/webdriver/BiDi/Browser/GetUserContextsCommand.cs

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,7 @@
1818
// </copyright>
1919

2020
using OpenQA.Selenium.BiDi.Communication;
21-
using OpenQA.Selenium.BiDi.Communication.Json.Converters.Enumerable;
22-
using System.Collections;
2321
using System.Collections.Generic;
24-
using System.Text.Json.Serialization;
2522

2623
namespace OpenQA.Selenium.BiDi.Browser;
2724

@@ -30,21 +27,4 @@ internal sealed class GetUserContextsCommand()
3027

3128
public class GetUserContextsOptions : CommandOptions;
3229

33-
[JsonConverter(typeof(GetUserContextsResultConverter))]
34-
public sealed record GetUserContextsResult : EmptyResult, IReadOnlyList<UserContextInfo>
35-
{
36-
internal GetUserContextsResult(IReadOnlyList<UserContextInfo> userContexts)
37-
{
38-
UserContexts = userContexts;
39-
}
40-
41-
public IReadOnlyList<UserContextInfo> UserContexts { get; }
42-
43-
public UserContextInfo this[int index] => UserContexts[index];
44-
45-
public int Count => UserContexts.Count;
46-
47-
public IEnumerator<UserContextInfo> GetEnumerator() => UserContexts.GetEnumerator();
48-
49-
IEnumerator IEnumerable.GetEnumerator() => (UserContexts as IEnumerable).GetEnumerator();
50-
}
30+
public sealed record GetUserContextsResult(IReadOnlyList<UserContextInfo> UserContexts) : EmptyResult;

dotnet/src/webdriver/BiDi/BrowsingContext/GetTreeCommand.cs

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,7 @@
1818
// </copyright>
1919

2020
using OpenQA.Selenium.BiDi.Communication;
21-
using OpenQA.Selenium.BiDi.Communication.Json.Converters.Enumerable;
22-
using System.Collections;
2321
using System.Collections.Generic;
24-
using System.Text.Json.Serialization;
2522

2623
namespace OpenQA.Selenium.BiDi.BrowsingContext;
2724

@@ -49,21 +46,4 @@ public sealed record BrowsingContextGetTreeOptions
4946
public long? MaxDepth { get; set; }
5047
}
5148

52-
[JsonConverter(typeof(GetTreeResultConverter))]
53-
public sealed record GetTreeResult : EmptyResult, IReadOnlyList<BrowsingContextInfo>
54-
{
55-
internal GetTreeResult(IReadOnlyList<BrowsingContextInfo> contexts)
56-
{
57-
Contexts = contexts;
58-
}
59-
60-
public IReadOnlyList<BrowsingContextInfo> Contexts { get; }
61-
62-
public BrowsingContextInfo this[int index] => Contexts[index];
63-
64-
public int Count => Contexts.Count;
65-
66-
public IEnumerator<BrowsingContextInfo> GetEnumerator() => Contexts.GetEnumerator();
67-
68-
IEnumerator IEnumerable.GetEnumerator() => (Contexts as IEnumerable).GetEnumerator();
69-
}
49+
public sealed record GetTreeResult(IReadOnlyList<BrowsingContextInfo> Contexts) : EmptyResult;

dotnet/src/webdriver/BiDi/BrowsingContext/LocateNodesCommand.cs

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,7 @@
1818
// </copyright>
1919

2020
using OpenQA.Selenium.BiDi.Communication;
21-
using OpenQA.Selenium.BiDi.Communication.Json.Converters.Enumerable;
22-
using System.Collections;
2321
using System.Collections.Generic;
24-
using System.Text.Json.Serialization;
2522

2623
namespace OpenQA.Selenium.BiDi.BrowsingContext;
2724

@@ -39,21 +36,4 @@ public sealed class LocateNodesOptions : CommandOptions
3936
public IEnumerable<Script.ISharedReference>? StartNodes { get; set; }
4037
}
4138

42-
[JsonConverter(typeof(LocateNodesResultConverter))]
43-
public sealed record LocateNodesResult : EmptyResult, IReadOnlyList<Script.NodeRemoteValue>
44-
{
45-
internal LocateNodesResult(IReadOnlyList<Script.NodeRemoteValue> nodes)
46-
{
47-
Nodes = nodes;
48-
}
49-
50-
public IReadOnlyList<Script.NodeRemoteValue> Nodes { get; }
51-
52-
public Script.NodeRemoteValue this[int index] => Nodes[index];
53-
54-
public int Count => Nodes.Count;
55-
56-
public IEnumerator<Script.NodeRemoteValue> GetEnumerator() => Nodes.GetEnumerator();
57-
58-
IEnumerator IEnumerable.GetEnumerator() => (Nodes as IEnumerable).GetEnumerator();
59-
}
39+
public sealed record LocateNodesResult(IReadOnlyList<Script.NodeRemoteValue> Nodes) : EmptyResult;

dotnet/src/webdriver/BiDi/Communication/Json/Converters/Enumerable/GetClientWindowsResultConverter.cs

Lines changed: 0 additions & 43 deletions
This file was deleted.

dotnet/src/webdriver/BiDi/Communication/Json/Converters/Enumerable/GetCookiesResultConverter.cs

Lines changed: 0 additions & 45 deletions
This file was deleted.

dotnet/src/webdriver/BiDi/Communication/Json/Converters/Enumerable/GetRealmsResultConverter.cs

Lines changed: 0 additions & 43 deletions
This file was deleted.

dotnet/src/webdriver/BiDi/Communication/Json/Converters/Enumerable/GetTreeResultConverter.cs

Lines changed: 0 additions & 43 deletions
This file was deleted.

dotnet/src/webdriver/BiDi/Communication/Json/Converters/Enumerable/GetUserContextsResultConverter.cs

Lines changed: 0 additions & 43 deletions
This file was deleted.

0 commit comments

Comments
 (0)