Skip to content

Commit 56c9d29

Browse files
authored
[dotnet] Use namespace file scoped (#15651)
Sorry if you see my face again here in the git history, but it simplifies the content.
1 parent 35adce2 commit 56c9d29

File tree

419 files changed

+46153
-46569
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

419 files changed

+46153
-46569
lines changed

dotnet/.editorconfig

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[*.cs]
2+
csharp_style_namespace_declarations=file_scoped:suggestion

dotnet/src/support/Events/EventFiringWebDriver.cs

+1,468-1,469
Large diffs are not rendered by default.

dotnet/src/support/Events/FindElementEventArgs.cs

+38-39
Original file line numberDiff line numberDiff line change
@@ -19,51 +19,50 @@
1919

2020
using System;
2121

22-
namespace OpenQA.Selenium.Support.Events
22+
namespace OpenQA.Selenium.Support.Events;
23+
24+
/// <summary>
25+
/// Provides data for events related to finding elements.
26+
/// </summary>
27+
public class FindElementEventArgs : EventArgs
2328
{
2429
/// <summary>
25-
/// Provides data for events related to finding elements.
30+
/// Initializes a new instance of the <see cref="FindElementEventArgs"/> class.
2631
/// </summary>
27-
public class FindElementEventArgs : EventArgs
32+
/// <param name="driver">The WebDriver instance used in finding elements.</param>
33+
/// <param name="method">The <see cref="By"/> object containing the method used to find elements.</param>
34+
/// <exception cref="ArgumentNullException">If <paramref name="driver"/> or <paramref name="method"/> are <see langword="null"/>.</exception>
35+
public FindElementEventArgs(IWebDriver driver, By method)
36+
: this(driver, null, method)
2837
{
29-
/// <summary>
30-
/// Initializes a new instance of the <see cref="FindElementEventArgs"/> class.
31-
/// </summary>
32-
/// <param name="driver">The WebDriver instance used in finding elements.</param>
33-
/// <param name="method">The <see cref="By"/> object containing the method used to find elements.</param>
34-
/// <exception cref="ArgumentNullException">If <paramref name="driver"/> or <paramref name="method"/> are <see langword="null"/>.</exception>
35-
public FindElementEventArgs(IWebDriver driver, By method)
36-
: this(driver, null, method)
37-
{
38-
}
38+
}
3939

40-
/// <summary>
41-
/// Initializes a new instance of the <see cref="FindElementEventArgs"/> class.
42-
/// </summary>
43-
/// <param name="driver">The WebDriver instance used in finding elements.</param>
44-
/// <param name="element">The parent element used as the context for the search, or <see langword="null"/> if none exists.</param>
45-
/// <param name="method">The <see cref="By"/> object containing the method used to find elements.</param>
46-
/// <exception cref="ArgumentNullException">If <paramref name="driver"/> or <paramref name="method"/> are <see langword="null"/>.</exception>
47-
public FindElementEventArgs(IWebDriver driver, IWebElement? element, By method)
48-
{
49-
this.Driver = driver ?? throw new ArgumentNullException(nameof(driver));
50-
this.Element = element;
51-
this.FindMethod = method ?? throw new ArgumentNullException(nameof(method));
52-
}
40+
/// <summary>
41+
/// Initializes a new instance of the <see cref="FindElementEventArgs"/> class.
42+
/// </summary>
43+
/// <param name="driver">The WebDriver instance used in finding elements.</param>
44+
/// <param name="element">The parent element used as the context for the search, or <see langword="null"/> if none exists.</param>
45+
/// <param name="method">The <see cref="By"/> object containing the method used to find elements.</param>
46+
/// <exception cref="ArgumentNullException">If <paramref name="driver"/> or <paramref name="method"/> are <see langword="null"/>.</exception>
47+
public FindElementEventArgs(IWebDriver driver, IWebElement? element, By method)
48+
{
49+
this.Driver = driver ?? throw new ArgumentNullException(nameof(driver));
50+
this.Element = element;
51+
this.FindMethod = method ?? throw new ArgumentNullException(nameof(method));
52+
}
5353

54-
/// <summary>
55-
/// Gets the WebDriver instance used in finding elements.
56-
/// </summary>
57-
public IWebDriver Driver { get; }
54+
/// <summary>
55+
/// Gets the WebDriver instance used in finding elements.
56+
/// </summary>
57+
public IWebDriver Driver { get; }
5858

59-
/// <summary>
60-
/// Gets the parent element used as the context for the search, or <see langword="null"/> if no element is associated.
61-
/// </summary>
62-
public IWebElement? Element { get; }
59+
/// <summary>
60+
/// Gets the parent element used as the context for the search, or <see langword="null"/> if no element is associated.
61+
/// </summary>
62+
public IWebElement? Element { get; }
6363

64-
/// <summary>
65-
/// Gets the <see cref="By"/> object containing the method used to find elements.
66-
/// </summary>
67-
public By FindMethod { get; }
68-
}
64+
/// <summary>
65+
/// Gets the <see cref="By"/> object containing the method used to find elements.
66+
/// </summary>
67+
public By FindMethod { get; }
6968
}

dotnet/src/support/Events/GetShadowRootEventArgs.cs

+22-23
Original file line numberDiff line numberDiff line change
@@ -19,33 +19,32 @@
1919

2020
using System;
2121

22-
namespace OpenQA.Selenium.Support.Events
22+
namespace OpenQA.Selenium.Support.Events;
23+
24+
/// <summary>
25+
/// Provides data for events related to getting shadow root of the web element.
26+
/// </summary>
27+
public class GetShadowRootEventArgs : EventArgs
2328
{
2429
/// <summary>
25-
/// Provides data for events related to getting shadow root of the web element.
30+
/// Initializes a new instance of the <see cref="GetShadowRootEventArgs"/> class.
2631
/// </summary>
27-
public class GetShadowRootEventArgs : EventArgs
32+
/// <param name="driver">The WebDriver instance used in the current context.</param>
33+
/// <param name="searchContext">The parent searc context used as the context for getting shadow root.</param>
34+
/// <exception cref="ArgumentNullException">If <paramref name="driver"/> or <paramref name="searchContext"/> are <see langword="null"/>.</exception>
35+
public GetShadowRootEventArgs(IWebDriver driver, ISearchContext searchContext)
2836
{
29-
/// <summary>
30-
/// Initializes a new instance of the <see cref="GetShadowRootEventArgs"/> class.
31-
/// </summary>
32-
/// <param name="driver">The WebDriver instance used in the current context.</param>
33-
/// <param name="searchContext">The parent searc context used as the context for getting shadow root.</param>
34-
/// <exception cref="ArgumentNullException">If <paramref name="driver"/> or <paramref name="searchContext"/> are <see langword="null"/>.</exception>
35-
public GetShadowRootEventArgs(IWebDriver driver, ISearchContext searchContext)
36-
{
37-
this.Driver = driver ?? throw new ArgumentNullException(nameof(driver));
38-
this.SearchContext = searchContext ?? throw new ArgumentNullException(nameof(searchContext));
39-
}
37+
this.Driver = driver ?? throw new ArgumentNullException(nameof(driver));
38+
this.SearchContext = searchContext ?? throw new ArgumentNullException(nameof(searchContext));
39+
}
4040

41-
/// <summary>
42-
/// Gets the WebDriver instance used in the current context.
43-
/// </summary>
44-
public IWebDriver Driver { get; }
41+
/// <summary>
42+
/// Gets the WebDriver instance used in the current context.
43+
/// </summary>
44+
public IWebDriver Driver { get; }
4545

46-
/// <summary>
47-
/// Gets the parent search context used as the context for getting shadow root.
48-
/// </summary>
49-
public ISearchContext SearchContext { get; }
50-
}
46+
/// <summary>
47+
/// Gets the parent search context used as the context for getting shadow root.
48+
/// </summary>
49+
public ISearchContext SearchContext { get; }
5150
}

dotnet/src/support/Events/WebDriverExceptionEventArgs.cs

+22-23
Original file line numberDiff line numberDiff line change
@@ -19,33 +19,32 @@
1919

2020
using System;
2121

22-
namespace OpenQA.Selenium.Support.Events
22+
namespace OpenQA.Selenium.Support.Events;
23+
24+
/// <summary>
25+
/// Provides data for events relating to exception handling.
26+
/// </summary>
27+
public class WebDriverExceptionEventArgs : EventArgs
2328
{
2429
/// <summary>
25-
/// Provides data for events relating to exception handling.
30+
/// Initializes a new instance of the <see cref="WebDriverExceptionEventArgs"/> class.
2631
/// </summary>
27-
public class WebDriverExceptionEventArgs : EventArgs
32+
/// <param name="driver">The WebDriver instance throwing the exception.</param>
33+
/// <param name="thrownException">The exception thrown by the driver.</param>
34+
/// <exception cref="ArgumentNullException">If <paramref name="driver"/> or <paramref name="thrownException"/> are <see langword="null"/>.</exception>
35+
public WebDriverExceptionEventArgs(IWebDriver driver, Exception thrownException)
2836
{
29-
/// <summary>
30-
/// Initializes a new instance of the <see cref="WebDriverExceptionEventArgs"/> class.
31-
/// </summary>
32-
/// <param name="driver">The WebDriver instance throwing the exception.</param>
33-
/// <param name="thrownException">The exception thrown by the driver.</param>
34-
/// <exception cref="ArgumentNullException">If <paramref name="driver"/> or <paramref name="thrownException"/> are <see langword="null"/>.</exception>
35-
public WebDriverExceptionEventArgs(IWebDriver driver, Exception thrownException)
36-
{
37-
this.Driver = driver ?? throw new ArgumentNullException(nameof(driver));
38-
this.ThrownException = thrownException ?? throw new ArgumentNullException(nameof(thrownException));
39-
}
37+
this.Driver = driver ?? throw new ArgumentNullException(nameof(driver));
38+
this.ThrownException = thrownException ?? throw new ArgumentNullException(nameof(thrownException));
39+
}
4040

41-
/// <summary>
42-
/// Gets the exception thrown by the driver.
43-
/// </summary>
44-
public Exception ThrownException { get; }
41+
/// <summary>
42+
/// Gets the exception thrown by the driver.
43+
/// </summary>
44+
public Exception ThrownException { get; }
4545

46-
/// <summary>
47-
/// Gets the WebDriver instance.
48-
/// </summary>
49-
public IWebDriver Driver { get; }
50-
}
46+
/// <summary>
47+
/// Gets the WebDriver instance.
48+
/// </summary>
49+
public IWebDriver Driver { get; }
5150
}

dotnet/src/support/Events/WebDriverNavigationEventArgs.cs

+31-32
Original file line numberDiff line numberDiff line change
@@ -19,43 +19,42 @@
1919

2020
using System;
2121

22-
namespace OpenQA.Selenium.Support.Events
22+
namespace OpenQA.Selenium.Support.Events;
23+
24+
/// <summary>
25+
/// Provides data for events relating to navigation.
26+
/// </summary>
27+
public class WebDriverNavigationEventArgs : EventArgs
2328
{
2429
/// <summary>
25-
/// Provides data for events relating to navigation.
30+
/// Initializes a new instance of the <see cref="WebDriverNavigationEventArgs"/> class.
2631
/// </summary>
27-
public class WebDriverNavigationEventArgs : EventArgs
32+
/// <param name="driver">The WebDriver instance used in navigation.</param>
33+
/// <exception cref="ArgumentNullException">If <paramref name="driver"/> is <see langword="null"/>.</exception>
34+
public WebDriverNavigationEventArgs(IWebDriver driver)
35+
: this(driver, null)
2836
{
29-
/// <summary>
30-
/// Initializes a new instance of the <see cref="WebDriverNavigationEventArgs"/> class.
31-
/// </summary>
32-
/// <param name="driver">The WebDriver instance used in navigation.</param>
33-
/// <exception cref="ArgumentNullException">If <paramref name="driver"/> is <see langword="null"/>.</exception>
34-
public WebDriverNavigationEventArgs(IWebDriver driver)
35-
: this(driver, null)
36-
{
37-
}
37+
}
3838

39-
/// <summary>
40-
/// Initializes a new instance of the <see cref="WebDriverNavigationEventArgs"/> class.
41-
/// </summary>
42-
/// <param name="driver">The WebDriver instance used in navigation.</param>
43-
/// <param name="url">The URL navigated to by the driver, or <see langword="null"/> if none exists.</param>
44-
/// <exception cref="ArgumentNullException">If <paramref name="driver"/> is <see langword="null"/>.</exception>
45-
public WebDriverNavigationEventArgs(IWebDriver driver, string? url)
46-
{
47-
this.Url = url;
48-
this.Driver = driver ?? throw new ArgumentNullException(nameof(driver));
49-
}
39+
/// <summary>
40+
/// Initializes a new instance of the <see cref="WebDriverNavigationEventArgs"/> class.
41+
/// </summary>
42+
/// <param name="driver">The WebDriver instance used in navigation.</param>
43+
/// <param name="url">The URL navigated to by the driver, or <see langword="null"/> if none exists.</param>
44+
/// <exception cref="ArgumentNullException">If <paramref name="driver"/> is <see langword="null"/>.</exception>
45+
public WebDriverNavigationEventArgs(IWebDriver driver, string? url)
46+
{
47+
this.Url = url;
48+
this.Driver = driver ?? throw new ArgumentNullException(nameof(driver));
49+
}
5050

51-
/// <summary>
52-
/// Gets the URL navigated to by the driver, or <see langword="null"/> if no URL could be determined.
53-
/// </summary>
54-
public string? Url { get; }
51+
/// <summary>
52+
/// Gets the URL navigated to by the driver, or <see langword="null"/> if no URL could be determined.
53+
/// </summary>
54+
public string? Url { get; }
5555

56-
/// <summary>
57-
/// Gets the WebDriver instance used in navigation.
58-
/// </summary>
59-
public IWebDriver Driver { get; }
60-
}
56+
/// <summary>
57+
/// Gets the WebDriver instance used in navigation.
58+
/// </summary>
59+
public IWebDriver Driver { get; }
6160
}

dotnet/src/support/Events/WebDriverScriptEventArgs.cs

+22-23
Original file line numberDiff line numberDiff line change
@@ -19,33 +19,32 @@
1919

2020
using System;
2121

22-
namespace OpenQA.Selenium.Support.Events
22+
namespace OpenQA.Selenium.Support.Events;
23+
24+
/// <summary>
25+
/// Provides data for events relating to executing JavaScript.
26+
/// </summary>
27+
public class WebDriverScriptEventArgs : EventArgs
2328
{
2429
/// <summary>
25-
/// Provides data for events relating to executing JavaScript.
30+
/// Initializes a new instance of the <see cref="WebDriverScriptEventArgs"/> class.
2631
/// </summary>
27-
public class WebDriverScriptEventArgs : EventArgs
32+
/// <param name="driver">The WebDriver instance used to execute the script.</param>
33+
/// <param name="script">The script executed by the driver.</param>
34+
/// <exception cref="ArgumentNullException">If <paramref name="driver"/> or <paramref name="script"/> are <see langword="null"/>.</exception>
35+
public WebDriverScriptEventArgs(IWebDriver driver, string script)
2836
{
29-
/// <summary>
30-
/// Initializes a new instance of the <see cref="WebDriverScriptEventArgs"/> class.
31-
/// </summary>
32-
/// <param name="driver">The WebDriver instance used to execute the script.</param>
33-
/// <param name="script">The script executed by the driver.</param>
34-
/// <exception cref="ArgumentNullException">If <paramref name="driver"/> or <paramref name="script"/> are <see langword="null"/>.</exception>
35-
public WebDriverScriptEventArgs(IWebDriver driver, string script)
36-
{
37-
this.Driver = driver ?? throw new ArgumentNullException(nameof(driver));
38-
this.Script = script ?? throw new ArgumentNullException(nameof(script));
39-
}
37+
this.Driver = driver ?? throw new ArgumentNullException(nameof(driver));
38+
this.Script = script ?? throw new ArgumentNullException(nameof(script));
39+
}
4040

41-
/// <summary>
42-
/// Gets the WebDriver instance used to execute the script.
43-
/// </summary>
44-
public IWebDriver Driver { get; }
41+
/// <summary>
42+
/// Gets the WebDriver instance used to execute the script.
43+
/// </summary>
44+
public IWebDriver Driver { get; }
4545

46-
/// <summary>
47-
/// Gets the script executed by the driver.
48-
/// </summary>
49-
public string Script { get; }
50-
}
46+
/// <summary>
47+
/// Gets the script executed by the driver.
48+
/// </summary>
49+
public string Script { get; }
5150
}

dotnet/src/support/Events/WebElementEventArgs.cs

+22-23
Original file line numberDiff line numberDiff line change
@@ -19,33 +19,32 @@
1919

2020
using System;
2121

22-
namespace OpenQA.Selenium.Support.Events
22+
namespace OpenQA.Selenium.Support.Events;
23+
24+
/// <summary>
25+
/// Provides data for events relating to elements.
26+
/// </summary>
27+
public class WebElementEventArgs : EventArgs
2328
{
2429
/// <summary>
25-
/// Provides data for events relating to elements.
30+
/// Initializes a new instance of the <see cref="WebElementEventArgs"/> class.
2631
/// </summary>
27-
public class WebElementEventArgs : EventArgs
32+
/// <param name="driver">The WebDriver instance used for the action.</param>
33+
/// <param name="element">The element used for the action.</param>
34+
/// <exception cref="ArgumentNullException">If <paramref name="driver"/> or <paramref name="element"/> are <see langword="null"/>.</exception>
35+
public WebElementEventArgs(IWebDriver driver, IWebElement element)
2836
{
29-
/// <summary>
30-
/// Initializes a new instance of the <see cref="WebElementEventArgs"/> class.
31-
/// </summary>
32-
/// <param name="driver">The WebDriver instance used for the action.</param>
33-
/// <param name="element">The element used for the action.</param>
34-
/// <exception cref="ArgumentNullException">If <paramref name="driver"/> or <paramref name="element"/> are <see langword="null"/>.</exception>
35-
public WebElementEventArgs(IWebDriver driver, IWebElement element)
36-
{
37-
this.Driver = driver ?? throw new ArgumentNullException(nameof(driver));
38-
this.Element = element ?? throw new ArgumentNullException(nameof(element));
39-
}
37+
this.Driver = driver ?? throw new ArgumentNullException(nameof(driver));
38+
this.Element = element ?? throw new ArgumentNullException(nameof(element));
39+
}
4040

41-
/// <summary>
42-
/// Gets the WebDriver instance used for the action.
43-
/// </summary>
44-
public IWebDriver Driver { get; }
41+
/// <summary>
42+
/// Gets the WebDriver instance used for the action.
43+
/// </summary>
44+
public IWebDriver Driver { get; }
4545

46-
/// <summary>
47-
/// Gets the element used for the action.
48-
/// </summary>
49-
public IWebElement Element { get; }
50-
}
46+
/// <summary>
47+
/// Gets the element used for the action.
48+
/// </summary>
49+
public IWebElement Element { get; }
5150
}

0 commit comments

Comments
 (0)