Skip to content

Commit 622ab4b

Browse files
authored
Merge pull request #62 from csf-dev/tech-fixes
Fix several tech issues
2 parents 1e656ba + 457a6be commit 622ab4b

9 files changed

Lines changed: 18 additions & 13 deletions

File tree

CSF.Extensions.WebDriver/Factories/WebDriverAndOptionsTypePair.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,16 @@ public sealed class WebDriverAndOptionsTypePair : IEquatable<WebDriverAndOptions
2222
/// <inheritdoc/>
2323
public override bool Equals(object obj) => Equals(obj as WebDriverAndOptionsTypePair);
2424

25-
/// <inheritdoc/>
26-
public override int GetHashCode() => WebDriverType.GetHashCode() ^ OptionsType.GetHashCode();
27-
2825
/// <inheritdoc/>
2926
public bool Equals(WebDriverAndOptionsTypePair other)
3027
{
3128
if (ReferenceEquals(other, null)) return false;
3229
return other.WebDriverType == WebDriverType && other.OptionsType == OptionsType;
3330
}
3431

32+
/// <inheritdoc/>
33+
public override int GetHashCode() => WebDriverType.GetHashCode() ^ OptionsType.GetHashCode();
34+
3535
/// <summary>
3636
/// Initialises a new instance of <see cref="WebDriverAndOptionsTypePair"/>.
3737
/// </summary>

CSF.Extensions.WebDriver/Factories/WebDriverCreationConfigureOptions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ void ConfigureUsingConfig(WebDriverCreationOptionsCollection options)
5151
if(driverConfigsSection != null) options.DriverConfigurations = GetDriverConfigurations(driverConfigsSection);
5252
}
5353

54-
IDictionary<string, WebDriverCreationOptions> GetDriverConfigurations(IConfigurationSection configuration)
54+
Dictionary<string, WebDriverCreationOptions> GetDriverConfigurations(IConfigurationSection configuration)
5555
=> configuration.GetChildren()
5656
.Select(c => new { c.Key, Value = configParser.GetDriverConfiguration(c) })
5757
.Where(x => x.Value != null)

CSF.Extensions.WebDriver/Identification/BrowserVersion.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public abstract class BrowserVersion : IEquatable<BrowserVersion>, IComparable<B
5757
/// Initialises a new instance of <see cref="BrowserVersion"/>.
5858
/// </summary>
5959
/// <param name="isPresumed">Whether or not this is a presumed version; see <see cref="IsPresumedVersion"/>.</param>
60-
protected internal BrowserVersion(bool isPresumed = false)
60+
private protected BrowserVersion(bool isPresumed = false)
6161
{
6262
IsPresumedVersion = isPresumed;
6363
}

CSF.Extensions.WebDriver/Identification/MissingBrowserVersion.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ public sealed class MissingBrowserVersion : BrowserVersion
1818
/// <inheritdoc/>
1919
public override bool Equals(BrowserVersion other) => other is MissingBrowserVersion;
2020

21+
/// <inheritdoc/>
22+
public override bool Equals(object obj) => obj is BrowserVersion ver && Equals(ver);
23+
2124
/// <inheritdoc/>
2225
public override int GetHashCode() => 17;
2326

CSF.Extensions.WebDriver/Identification/UnrecognisedBrowserVersion.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,20 @@ public sealed class UnrecognisedBrowserVersion : BrowserVersion
2727
/// <inheritdoc/>
2828
public override int CompareTo(BrowserVersion other)
2929
{
30-
if (other is null || !(other is UnrecognisedBrowserVersion version)) return 1;
30+
if (!(other is UnrecognisedBrowserVersion version)) return 1;
3131
return string.Compare(Version, version.Version, StringComparison.InvariantCulture);
3232
}
3333

3434
/// <inheritdoc/>
3535
public override bool Equals(BrowserVersion other)
3636
{
37-
if (other is null || !(other is UnrecognisedBrowserVersion version)) return false;
37+
if (!(other is UnrecognisedBrowserVersion version)) return false;
3838
return Version.Equals(version.Version, StringComparison.InvariantCulture);
3939
}
4040

41+
/// <inheritdoc/>
42+
public override bool Equals(object obj) => obj is BrowserVersion ver && Equals(ver);
43+
4144
/// <inheritdoc/>
4245
public override int GetHashCode() => Version.GetHashCode();
4346

CSF.Extensions.WebDriver/Proxies/Is.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
using System;
21
using System.Reflection;
32

43
namespace CSF.Extensions.WebDriver.Proxies
54
{
65
/// <summary>
76
/// Utility/helper class to identify members.
87
/// </summary>
9-
internal class Is
8+
internal static class Is
109
{
1110
const string getterPrefix = "get_";
1211

@@ -20,6 +19,6 @@ internal class Is
2019
/// <returns><see langword="true" /> if the <paramref name="method"/> is a getter for a property named
2120
/// <paramref name="name"/>, upon the type <typeparamref name="T"/>; <see langword="false" /> if not.</returns>
2221
internal static bool Getter<T>(string name, MethodInfo method) where T : class
23-
=> method.DeclaringType == typeof(T) && method.Name == String.Concat(getterPrefix, name);
22+
=> method.DeclaringType == typeof(T) && method.Name == string.Concat(getterPrefix, name);
2423
}
2524
}

CSF.Extensions.WebDriver/Proxies/QuirksAugmenter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public void AugmentContext(WebDriverProxyCreationContext context)
2222
if (!context.CreationOptions.AddQuirks) return;
2323

2424
context.Interfaces.Add(typeof(IHasQuirks));
25-
context.Interceptors.Add(ActivatorUtilities.CreateInstance<QuirksInterceptor>(services, new [] {context.BrowserId}));
25+
context.Interceptors.Add(ActivatorUtilities.CreateInstance<QuirksInterceptor>(services, context.BrowserId));
2626
}
2727

2828
/// <summary>

CSF.Extensions.WebDriver/Quirks/QuirksDataProvider.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public class QuirksDataProvider : IGetsQuirksData
4646
/// <inheritdoc/>
4747
public QuirksData GetQuirksData() => data;
4848

49-
QuirksData MergeQuirksData(QuirksData primary, QuirksData secondary = null)
49+
static QuirksData MergeQuirksData(QuirksData primary, QuirksData secondary = null)
5050
{
5151
if (primary is null) throw new ArgumentNullException(nameof(primary));
5252
if (secondary is null) return primary.DeepCopy();

CSF.Extensions.WebDriver/ServiceCollectionExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ public static IServiceCollection AddWebDriverQuirks(this IServiceCollection serv
230230
services.AddSingleton<IGetsQuirksData>(s =>
231231
{
232232
if (!useOptions) return new QuirksDataProvider(quirksData);
233-
return ActivatorUtilities.CreateInstance<QuirksDataProvider>(s, new[] { quirksData ?? QuirksData.Empty });
233+
return ActivatorUtilities.CreateInstance<QuirksDataProvider>(s, quirksData ?? QuirksData.Empty);
234234
});
235235

236236
return services;

0 commit comments

Comments
 (0)