How to use Equals method of PuppeteerSharp.Media.MarginOptions class

Best Puppeteer-sharp code snippet using PuppeteerSharp.Media.MarginOptions.Equals

Run Puppeteer-sharp automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

MarginOptions.cs

Source: MarginOptions.cs Github

copy
1using System;
2using System.Collections.Generic;
3
4namespace PuppeteerSharp.Media
5{
6    /// <summary>
7    /// margin options used in <see cref="PdfOptions"/>
8    /// </summary>
9    public class MarginOptions : IEquatable<MarginOptions>
10    {
11        /// <summary>
12        /// Initializes a new instance of the <see cref="PuppeteerSharp.Media.MarginOptions"/> class.
13        /// </summary>
14        public MarginOptions() { }
15
16        /// <summary>
17        /// Top margin, accepts values labeled with units
18        /// </summary>
19        public string Top { get; set; }
20
21        /// <summary>
22        /// Left margin, accepts values labeled with units
23        /// </summary>
24        public string Left { get; set; }
25
26        /// <summary>
27        /// Bottom margin, accepts values labeled with units
28        /// </summary>
29        public string Bottom { get; set; }
30
31        /// <summary>
32        /// Right margin, accepts values labeled with units
33        /// </summary>
34        public string Right { get; set; }
35
36        /// <inheritdoc/>
37        public override bool Equals(object obj)
38        {
39            if (obj == null || GetType() != obj.GetType())
40            {
41                return false;
42            }
43
44            return Equals((MarginOptions)obj);
45        }
46
47        /// <inheritdoc/>
48        public bool Equals(MarginOptions options)
49            => options != null &&
50                   Top == options.Top &&
51                   Left == options.Left &&
52                   Bottom == options.Bottom &&
53                   Right == options.Right;
54
55        /// <inheritdoc/>
56        public override int GetHashCode()
57            => -481391125
58                ^ EqualityComparer<string>.Default.GetHashCode(Top)
59                ^ EqualityComparer<string>.Default.GetHashCode(Left)
60                ^ EqualityComparer<string>.Default.GetHashCode(Bottom)
61                ^ EqualityComparer<string>.Default.GetHashCode(Right);
62
63        /// <inheritdoc/>
64        public static bool operator ==(MarginOptions left, MarginOptions right)
65            => EqualityComparer<MarginOptions>.Default.Equals(left, right);
66        /// <inheritdoc/>
67        public static bool operator !=(MarginOptions left, MarginOptions right) => !(left == right);
68    }
69}
Full Screen

Accelerate Your Automation Test Cycles With LambdaTest

Leverage LambdaTest’s cloud-based platform to execute your automation tests in parallel and trim down your test execution time significantly. Your first 100 automation testing minutes are on us.

Try LambdaTest

Most used method in MarginOptions

Trigger Equals code on LambdaTest Cloud Grid

Execute automation tests with Equals on a cloud-based Grid of 3000+ real browsers and operating systems for both web and mobile applications.

Test now for Free
LambdaTestX

We use cookies to give you the best experience. Cookies help to provide a more personalized experience and relevant advertising for you, and web analytics for us. Learn More in our Cookies policy, Privacy & Terms of service

Allow Cookie
Sarah

I hope you find the best code examples for your project.

If you want to accelerate automated browser testing, try LambdaTest. Your first 100 automation testing minutes are FREE.

Sarah Elson (Product & Growth Lead)