Updating .NET RemoteSessionSettings to properly return capabilities by index
@@ -45,6 +45,28 @@ public RemoteSessionSettings()
{
}
+ /// <summary>
+ /// Creates a new instance of the <see cref="RemoteSessionSettings"/> class,
+ /// containing the specified <see cref="DriverOptions"/> to use in the remote
+ /// session.
+ /// </summary>
+ /// <param name="mustMatchDriverOptions">
+ /// A <see cref="DriverOptions"/> object that contains values that must be matched
+ /// by the remote end to create the remote session.
+ /// </param>
+ /// <param name="firstMatchDriverOptions">
+ /// A list of <see cref="DriverOptions"/> objects that contain values that may be matched
+ /// by the remote end to create the remote session.
+ /// </param>
+ public RemoteSessionSettings(DriverOptions mustMatchDriverOptions, params DriverOptions[] firstMatchDriverOptions)
+ {
+ this.mustMatchDriverOptions = mustMatchDriverOptions;
+ foreach (DriverOptions firstMatchOption in firstMatchDriverOptions)
+ {
+ this.AddFirstMatchDriverOption(firstMatchOption);
+ }
+ }
+
/// <summary>
/// Gets a value indicating the options that must be matched by the remote end to create a session.
/// </summary>
@@ -88,40 +110,11 @@ internal int FirstMatchOptionsCount
throw new ArgumentException(string.Format(CultureInfo.InvariantCulture, "The capability {0} is not present in this set of capabilities", capabilityName));
}
- return null;
-
- if (!this.remoteMetadataSettings.ContainsKey(capabilityName))
- {
- throw new ArgumentException(string.Format(CultureInfo.InvariantCulture, "The capability {0} is not present in this set of capabilities", capabilityName));
- }
-
return this.remoteMetadataSettings[capabilityName];
}
}
- /// <summary>
- /// Creates a new instance of the <see cref="RemoteSessionSettings"/> class,
- /// containing the specified <see cref="DriverOptions"/> to use in the remote
- /// session.
- /// </summary>
- /// <param name="mustMatchDriverOptions">
- /// A <see cref="DriverOptions"/> object that contains values that must be matched
- /// by the remote end to create the remote session.
- /// </param>
- /// <param name="firstMatchDriverOptions">
- /// A list of <see cref="DriverOptions"/> objects that contain values that may be matched
- /// by the remote end to create the remote session.
- /// </param>
- public RemoteSessionSettings(DriverOptions mustMatchDriverOptions, params DriverOptions[] firstMatchDriverOptions)
- {
- this.mustMatchDriverOptions = mustMatchDriverOptions;
- foreach (DriverOptions firstMatchOption in firstMatchDriverOptions)
- {
- this.AddFirstMatchDriverOption(firstMatchOption);
- }
- }
-
/// <summary>
/// Add a metadata setting to this set of remote session settings.
/// </summary>
