Menu

#56 Add parameter to ignore querystrings when using Find.ByUrl

Version_1.2.0
closed
5
2012-09-15
2007-07-06
Anonymous
No

When using Find.ByUrl() you must currently provide the full url including querystring to make a match. Adding overloads with a bool parameter for ignoreQuery to Find.ByUrl(string) and Find.ByUrl(Uri) would allow people to ignore querystrings when appropriate without hurting compatibility to current code.

I have attached the code needed to make this happen including a unit test for the added functionality in UriComparer and additions to unit tests for the Find and Url changes.

Note: this functionality actually exists by using a regex for the compare instead of a Uri or a string but I wanted to be able to do this without a regex.

Discussion

  • Nobody/Anonymous

    new FindBy.cs and unit test updates.

     
  • Jeroen van Menen

    Logged In: YES
    user_id=799177
    Originator: NO

    Will be in the next release

     
  • hfrmobile

    hfrmobile - 2009-03-09

    meanwhile (until the overload is implemented):

    using System;

    namespace Rubicon.Logistics.Web.Testing.Utilities
    {
    internal class StartsWithComparer : WatiN.Core.Comparers.StringComparer
    {
    public StartsWithComparer(string value) : base(value)
    {
    }

        public override bool Compare(string value)
        {
            return value != null && value.StartsWith(valueToCompareWith);
        }
    }
    

    }

     

Log in to post a comment.