Custom Verification Extension Method for Generic Page Object

How to implement custom verification extension method for a generic page object.

Given

There are similar page verifications in tests that are possible to extract to extention methods.

Implementation

using Atata;

namespace SampleApp.UITests
{
    public static class IPageObjectVerificationProviderExtensions
    {
        public static TPageObject BeOnEditPage<TPageObject>(this IPageObjectVerificationProvider<TPageObject> should)
            where TPageObject : PageObject<TPageObject>
        {
            return should.Component.PageUrl.Should.WithSettings(should).Contain("/Edit.aspx");
        }
    }
}

Usage

Go.To<SomePage>()
    .Should.BeOnEditPage();