Skip to content
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,16 @@ public sealed class WebDriverAndOptionsTypePair : IEquatable<WebDriverAndOptions
/// <inheritdoc/>
public override bool Equals(object obj) => Equals(obj as WebDriverAndOptionsTypePair);

/// <inheritdoc/>
public override int GetHashCode() => WebDriverType.GetHashCode() ^ OptionsType.GetHashCode();

/// <inheritdoc/>
public bool Equals(WebDriverAndOptionsTypePair other)
{
if (ReferenceEquals(other, null)) return false;
return other.WebDriverType == WebDriverType && other.OptionsType == OptionsType;
}

/// <inheritdoc/>
public override int GetHashCode() => WebDriverType.GetHashCode() ^ OptionsType.GetHashCode();

/// <summary>
/// Initialises a new instance of <see cref="WebDriverAndOptionsTypePair"/>.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ void ConfigureUsingConfig(WebDriverCreationOptionsCollection options)
if(driverConfigsSection != null) options.DriverConfigurations = GetDriverConfigurations(driverConfigsSection);
}

IDictionary<string, WebDriverCreationOptions> GetDriverConfigurations(IConfigurationSection configuration)
Dictionary<string, WebDriverCreationOptions> GetDriverConfigurations(IConfigurationSection configuration)
=> configuration.GetChildren()
.Select(c => new { c.Key, Value = configParser.GetDriverConfiguration(c) })
.Where(x => x.Value != null)
Expand Down
2 changes: 1 addition & 1 deletion CSF.Extensions.WebDriver/Identification/BrowserVersion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public abstract class BrowserVersion : IEquatable<BrowserVersion>, IComparable<B
/// Initialises a new instance of <see cref="BrowserVersion"/>.
/// </summary>
/// <param name="isPresumed">Whether or not this is a presumed version; see <see cref="IsPresumedVersion"/>.</param>
protected internal BrowserVersion(bool isPresumed = false)
private protected BrowserVersion(bool isPresumed = false)
{
IsPresumedVersion = isPresumed;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ public sealed class MissingBrowserVersion : BrowserVersion
/// <inheritdoc/>
public override bool Equals(BrowserVersion other) => other is MissingBrowserVersion;

/// <inheritdoc/>
public override bool Equals(object obj) => obj is BrowserVersion ver && Equals(ver);

/// <inheritdoc/>
public override int GetHashCode() => 17;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,20 @@ public sealed class UnrecognisedBrowserVersion : BrowserVersion
/// <inheritdoc/>
public override int CompareTo(BrowserVersion other)
{
if (other is null || !(other is UnrecognisedBrowserVersion version)) return 1;
if (!(other is UnrecognisedBrowserVersion version)) return 1;
return string.Compare(Version, version.Version, StringComparison.InvariantCulture);
}

/// <inheritdoc/>
public override bool Equals(BrowserVersion other)
{
if (other is null || !(other is UnrecognisedBrowserVersion version)) return false;
if (!(other is UnrecognisedBrowserVersion version)) return false;
return Version.Equals(version.Version, StringComparison.InvariantCulture);
}

/// <inheritdoc/>
public override bool Equals(object obj) => obj is BrowserVersion ver && Equals(ver);

/// <inheritdoc/>
public override int GetHashCode() => Version.GetHashCode();

Expand Down
5 changes: 2 additions & 3 deletions CSF.Extensions.WebDriver/Proxies/Is.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
using System;
using System.Reflection;

namespace CSF.Extensions.WebDriver.Proxies
{
/// <summary>
/// Utility/helper class to identify members.
/// </summary>
internal class Is
internal static class Is
{
const string getterPrefix = "get_";

Expand All @@ -20,6 +19,6 @@ internal class Is
/// <returns><see langword="true" /> if the <paramref name="method"/> is a getter for a property named
/// <paramref name="name"/>, upon the type <typeparamref name="T"/>; <see langword="false" /> if not.</returns>
internal static bool Getter<T>(string name, MethodInfo method) where T : class
=> method.DeclaringType == typeof(T) && method.Name == String.Concat(getterPrefix, name);
=> method.DeclaringType == typeof(T) && method.Name == string.Concat(getterPrefix, name);
}
}
2 changes: 1 addition & 1 deletion CSF.Extensions.WebDriver/Proxies/QuirksAugmenter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public void AugmentContext(WebDriverProxyCreationContext context)
if (!context.CreationOptions.AddQuirks) return;

context.Interfaces.Add(typeof(IHasQuirks));
context.Interceptors.Add(ActivatorUtilities.CreateInstance<QuirksInterceptor>(services, new [] {context.BrowserId}));
context.Interceptors.Add(ActivatorUtilities.CreateInstance<QuirksInterceptor>(services, context.BrowserId));
}

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion CSF.Extensions.WebDriver/Quirks/QuirksDataProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public class QuirksDataProvider : IGetsQuirksData
/// <inheritdoc/>
public QuirksData GetQuirksData() => data;

QuirksData MergeQuirksData(QuirksData primary, QuirksData secondary = null)
static QuirksData MergeQuirksData(QuirksData primary, QuirksData secondary = null)
{
if (primary is null) throw new ArgumentNullException(nameof(primary));
if (secondary is null) return primary.DeepCopy();
Expand Down
2 changes: 1 addition & 1 deletion CSF.Extensions.WebDriver/ServiceCollectionExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ public static IServiceCollection AddWebDriverQuirks(this IServiceCollection serv
services.AddSingleton<IGetsQuirksData>(s =>
{
if (!useOptions) return new QuirksDataProvider(quirksData);
return ActivatorUtilities.CreateInstance<QuirksDataProvider>(s, new[] { quirksData ?? QuirksData.Empty });
return ActivatorUtilities.CreateInstance<QuirksDataProvider>(s, quirksData ?? QuirksData.Empty);
});

return services;
Expand Down
Loading