Skip to content

Commit 43182ff

Browse files
committed
Implement IEquatable on InitializationScript
1 parent 78cc853 commit 43182ff

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

dotnet/src/webdriver/InitializationScript.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,15 @@
1717
// under the License.
1818
// </copyright>
1919

20+
using System;
2021
using System.Globalization;
2122

2223
namespace OpenQA.Selenium
2324
{
2425
/// <summary>
2526
/// Represents a JavaScript script that is loaded and run on every document load.
2627
/// </summary>
27-
public class InitializationScript
28+
public class InitializationScript : IEquatable<InitializationScript>
2829
{
2930
/// <summary>
3031
/// Gets the internal ID of the initialization script.
@@ -41,6 +42,16 @@ public class InitializationScript
4142
/// </summary>
4243
public string ScriptSource { get; internal set; }
4344

45+
/// <summary>
46+
/// Indicates whether the current <see cref="InitializationScript"/> is equal to another <see cref="InitializationScript"/> of the same type.
47+
/// </summary>
48+
/// <param name="other">An <see cref="InitializationScript"/> to compare with this <see cref="InitializationScript"/>.</param>
49+
/// <returns><see langword="true"/> if the current <see cref="InitializationScript"/> is equal to the other parameter; otherwise, <see langword="false"/>.</returns>
50+
public bool Equals(InitializationScript other)
51+
{
52+
return other is not null && this.ScriptId == other.ScriptId && this.ScriptName == other.ScriptName && this.ScriptSource == other.ScriptSource;
53+
}
54+
4455
/// <summary>
4556
/// Returns a string that represents the current object.
4657
/// </summary>

0 commit comments

Comments
 (0)