Skip to content

[dotnet] Use namespace file scoped #15651

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 2 additions & 0 deletions dotnet/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[*.cs]
csharp_style_namespace_declarations=file_scoped:suggestion
2,937 changes: 1,468 additions & 1,469 deletions dotnet/src/support/Events/EventFiringWebDriver.cs

Large diffs are not rendered by default.

77 changes: 38 additions & 39 deletions dotnet/src/support/Events/FindElementEventArgs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,51 +19,50 @@

using System;

namespace OpenQA.Selenium.Support.Events
namespace OpenQA.Selenium.Support.Events;

/// <summary>
/// Provides data for events related to finding elements.
/// </summary>
public class FindElementEventArgs : EventArgs
{
/// <summary>
/// Provides data for events related to finding elements.
/// Initializes a new instance of the <see cref="FindElementEventArgs"/> class.
/// </summary>
public class FindElementEventArgs : EventArgs
/// <param name="driver">The WebDriver instance used in finding elements.</param>
/// <param name="method">The <see cref="By"/> object containing the method used to find elements.</param>
/// <exception cref="ArgumentNullException">If <paramref name="driver"/> or <paramref name="method"/> are <see langword="null"/>.</exception>
public FindElementEventArgs(IWebDriver driver, By method)
: this(driver, null, method)
{
/// <summary>
/// Initializes a new instance of the <see cref="FindElementEventArgs"/> class.
/// </summary>
/// <param name="driver">The WebDriver instance used in finding elements.</param>
/// <param name="method">The <see cref="By"/> object containing the method used to find elements.</param>
/// <exception cref="ArgumentNullException">If <paramref name="driver"/> or <paramref name="method"/> are <see langword="null"/>.</exception>
public FindElementEventArgs(IWebDriver driver, By method)
: this(driver, null, method)
{
}
}

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

/// <summary>
/// Gets the WebDriver instance used in finding elements.
/// </summary>
public IWebDriver Driver { get; }
/// <summary>
/// Gets the WebDriver instance used in finding elements.
/// </summary>
public IWebDriver Driver { get; }

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

/// <summary>
/// Gets the <see cref="By"/> object containing the method used to find elements.
/// </summary>
public By FindMethod { get; }
}
/// <summary>
/// Gets the <see cref="By"/> object containing the method used to find elements.
/// </summary>
public By FindMethod { get; }
}
45 changes: 22 additions & 23 deletions dotnet/src/support/Events/GetShadowRootEventArgs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,33 +19,32 @@

using System;

namespace OpenQA.Selenium.Support.Events
namespace OpenQA.Selenium.Support.Events;

/// <summary>
/// Provides data for events related to getting shadow root of the web element.
/// </summary>
public class GetShadowRootEventArgs : EventArgs
{
/// <summary>
/// Provides data for events related to getting shadow root of the web element.
/// Initializes a new instance of the <see cref="GetShadowRootEventArgs"/> class.
/// </summary>
public class GetShadowRootEventArgs : EventArgs
/// <param name="driver">The WebDriver instance used in the current context.</param>
/// <param name="searchContext">The parent searc context used as the context for getting shadow root.</param>
/// <exception cref="ArgumentNullException">If <paramref name="driver"/> or <paramref name="searchContext"/> are <see langword="null"/>.</exception>
public GetShadowRootEventArgs(IWebDriver driver, ISearchContext searchContext)
{
/// <summary>
/// Initializes a new instance of the <see cref="GetShadowRootEventArgs"/> class.
/// </summary>
/// <param name="driver">The WebDriver instance used in the current context.</param>
/// <param name="searchContext">The parent searc context used as the context for getting shadow root.</param>
/// <exception cref="ArgumentNullException">If <paramref name="driver"/> or <paramref name="searchContext"/> are <see langword="null"/>.</exception>
public GetShadowRootEventArgs(IWebDriver driver, ISearchContext searchContext)
{
this.Driver = driver ?? throw new ArgumentNullException(nameof(driver));
this.SearchContext = searchContext ?? throw new ArgumentNullException(nameof(searchContext));
}
this.Driver = driver ?? throw new ArgumentNullException(nameof(driver));
this.SearchContext = searchContext ?? throw new ArgumentNullException(nameof(searchContext));
}

/// <summary>
/// Gets the WebDriver instance used in the current context.
/// </summary>
public IWebDriver Driver { get; }
/// <summary>
/// Gets the WebDriver instance used in the current context.
/// </summary>
public IWebDriver Driver { get; }

/// <summary>
/// Gets the parent search context used as the context for getting shadow root.
/// </summary>
public ISearchContext SearchContext { get; }
}
/// <summary>
/// Gets the parent search context used as the context for getting shadow root.
/// </summary>
public ISearchContext SearchContext { get; }
}
45 changes: 22 additions & 23 deletions dotnet/src/support/Events/WebDriverExceptionEventArgs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,33 +19,32 @@

using System;

namespace OpenQA.Selenium.Support.Events
namespace OpenQA.Selenium.Support.Events;

/// <summary>
/// Provides data for events relating to exception handling.
/// </summary>
public class WebDriverExceptionEventArgs : EventArgs
{
/// <summary>
/// Provides data for events relating to exception handling.
/// Initializes a new instance of the <see cref="WebDriverExceptionEventArgs"/> class.
/// </summary>
public class WebDriverExceptionEventArgs : EventArgs
/// <param name="driver">The WebDriver instance throwing the exception.</param>
/// <param name="thrownException">The exception thrown by the driver.</param>
/// <exception cref="ArgumentNullException">If <paramref name="driver"/> or <paramref name="thrownException"/> are <see langword="null"/>.</exception>
public WebDriverExceptionEventArgs(IWebDriver driver, Exception thrownException)
{
/// <summary>
/// Initializes a new instance of the <see cref="WebDriverExceptionEventArgs"/> class.
/// </summary>
/// <param name="driver">The WebDriver instance throwing the exception.</param>
/// <param name="thrownException">The exception thrown by the driver.</param>
/// <exception cref="ArgumentNullException">If <paramref name="driver"/> or <paramref name="thrownException"/> are <see langword="null"/>.</exception>
public WebDriverExceptionEventArgs(IWebDriver driver, Exception thrownException)
{
this.Driver = driver ?? throw new ArgumentNullException(nameof(driver));
this.ThrownException = thrownException ?? throw new ArgumentNullException(nameof(thrownException));
}
this.Driver = driver ?? throw new ArgumentNullException(nameof(driver));
this.ThrownException = thrownException ?? throw new ArgumentNullException(nameof(thrownException));
}

/// <summary>
/// Gets the exception thrown by the driver.
/// </summary>
public Exception ThrownException { get; }
/// <summary>
/// Gets the exception thrown by the driver.
/// </summary>
public Exception ThrownException { get; }

/// <summary>
/// Gets the WebDriver instance.
/// </summary>
public IWebDriver Driver { get; }
}
/// <summary>
/// Gets the WebDriver instance.
/// </summary>
public IWebDriver Driver { get; }
}
63 changes: 31 additions & 32 deletions dotnet/src/support/Events/WebDriverNavigationEventArgs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,43 +19,42 @@

using System;

namespace OpenQA.Selenium.Support.Events
namespace OpenQA.Selenium.Support.Events;

/// <summary>
/// Provides data for events relating to navigation.
/// </summary>
public class WebDriverNavigationEventArgs : EventArgs
{
/// <summary>
/// Provides data for events relating to navigation.
/// Initializes a new instance of the <see cref="WebDriverNavigationEventArgs"/> class.
/// </summary>
public class WebDriverNavigationEventArgs : EventArgs
/// <param name="driver">The WebDriver instance used in navigation.</param>
/// <exception cref="ArgumentNullException">If <paramref name="driver"/> is <see langword="null"/>.</exception>
public WebDriverNavigationEventArgs(IWebDriver driver)
: this(driver, null)
{
/// <summary>
/// Initializes a new instance of the <see cref="WebDriverNavigationEventArgs"/> class.
/// </summary>
/// <param name="driver">The WebDriver instance used in navigation.</param>
/// <exception cref="ArgumentNullException">If <paramref name="driver"/> is <see langword="null"/>.</exception>
public WebDriverNavigationEventArgs(IWebDriver driver)
: this(driver, null)
{
}
}

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

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

/// <summary>
/// Gets the WebDriver instance used in navigation.
/// </summary>
public IWebDriver Driver { get; }
}
/// <summary>
/// Gets the WebDriver instance used in navigation.
/// </summary>
public IWebDriver Driver { get; }
}
45 changes: 22 additions & 23 deletions dotnet/src/support/Events/WebDriverScriptEventArgs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,33 +19,32 @@

using System;

namespace OpenQA.Selenium.Support.Events
namespace OpenQA.Selenium.Support.Events;

/// <summary>
/// Provides data for events relating to executing JavaScript.
/// </summary>
public class WebDriverScriptEventArgs : EventArgs
{
/// <summary>
/// Provides data for events relating to executing JavaScript.
/// Initializes a new instance of the <see cref="WebDriverScriptEventArgs"/> class.
/// </summary>
public class WebDriverScriptEventArgs : EventArgs
/// <param name="driver">The WebDriver instance used to execute the script.</param>
/// <param name="script">The script executed by the driver.</param>
/// <exception cref="ArgumentNullException">If <paramref name="driver"/> or <paramref name="script"/> are <see langword="null"/>.</exception>
public WebDriverScriptEventArgs(IWebDriver driver, string script)
{
/// <summary>
/// Initializes a new instance of the <see cref="WebDriverScriptEventArgs"/> class.
/// </summary>
/// <param name="driver">The WebDriver instance used to execute the script.</param>
/// <param name="script">The script executed by the driver.</param>
/// <exception cref="ArgumentNullException">If <paramref name="driver"/> or <paramref name="script"/> are <see langword="null"/>.</exception>
public WebDriverScriptEventArgs(IWebDriver driver, string script)
{
this.Driver = driver ?? throw new ArgumentNullException(nameof(driver));
this.Script = script ?? throw new ArgumentNullException(nameof(script));
}
this.Driver = driver ?? throw new ArgumentNullException(nameof(driver));
this.Script = script ?? throw new ArgumentNullException(nameof(script));
}

/// <summary>
/// Gets the WebDriver instance used to execute the script.
/// </summary>
public IWebDriver Driver { get; }
/// <summary>
/// Gets the WebDriver instance used to execute the script.
/// </summary>
public IWebDriver Driver { get; }

/// <summary>
/// Gets the script executed by the driver.
/// </summary>
public string Script { get; }
}
/// <summary>
/// Gets the script executed by the driver.
/// </summary>
public string Script { get; }
}
45 changes: 22 additions & 23 deletions dotnet/src/support/Events/WebElementEventArgs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,33 +19,32 @@

using System;

namespace OpenQA.Selenium.Support.Events
namespace OpenQA.Selenium.Support.Events;

/// <summary>
/// Provides data for events relating to elements.
/// </summary>
public class WebElementEventArgs : EventArgs
{
/// <summary>
/// Provides data for events relating to elements.
/// Initializes a new instance of the <see cref="WebElementEventArgs"/> class.
/// </summary>
public class WebElementEventArgs : EventArgs
/// <param name="driver">The WebDriver instance used for the action.</param>
/// <param name="element">The element used for the action.</param>
/// <exception cref="ArgumentNullException">If <paramref name="driver"/> or <paramref name="element"/> are <see langword="null"/>.</exception>
public WebElementEventArgs(IWebDriver driver, IWebElement element)
{
/// <summary>
/// Initializes a new instance of the <see cref="WebElementEventArgs"/> class.
/// </summary>
/// <param name="driver">The WebDriver instance used for the action.</param>
/// <param name="element">The element used for the action.</param>
/// <exception cref="ArgumentNullException">If <paramref name="driver"/> or <paramref name="element"/> are <see langword="null"/>.</exception>
public WebElementEventArgs(IWebDriver driver, IWebElement element)
{
this.Driver = driver ?? throw new ArgumentNullException(nameof(driver));
this.Element = element ?? throw new ArgumentNullException(nameof(element));
}
this.Driver = driver ?? throw new ArgumentNullException(nameof(driver));
this.Element = element ?? throw new ArgumentNullException(nameof(element));
}

/// <summary>
/// Gets the WebDriver instance used for the action.
/// </summary>
public IWebDriver Driver { get; }
/// <summary>
/// Gets the WebDriver instance used for the action.
/// </summary>
public IWebDriver Driver { get; }

/// <summary>
/// Gets the element used for the action.
/// </summary>
public IWebElement Element { get; }
}
/// <summary>
/// Gets the element used for the action.
/// </summary>
public IWebElement Element { get; }
}
Loading
Loading