/// <inheritdoc /> protected override bool MatchesImpl(IAttributeBag attributeBag, ConstraintContext context) { int counter = ((int?)context.GetData(this)).GetValueOrDefault(); context.SetData(this, counter + 1); return(counter == index); }
/// <inheritdoc /> protected override bool MatchesImpl(IAttributeBag attributeBag, ConstraintContext context) { var element = attributeBag.GetAdapter<Element>(); if (element == null) throw new WatiNException("This constraint class can only be used to compare against an element"); var cache = (LabelCache)context.GetData(this); if (cache == null) { cache = new LabelCache(labelText); context.SetData(this, cache); } return cache.IsMatch(element); }
/// <inheritdoc /> protected override bool MatchesImpl(IAttributeBag attributeBag, ConstraintContext context) { var element = attributeBag.GetAdapter <Element>(); if (element == null) { throw new WatiNException("This constraint class can only be used to compare against an element"); } var cache = (LabelCache)context.GetData(this); if (cache == null) { cache = new LabelCache(labelText); context.SetData(this, cache); } return(cache.IsMatch(element)); }
/// <inheritdoc /> public override bool MatchesImpl(IAttributeBag attributeBag, ConstraintContext context) { int counter = ((int?)context.GetData(this)).GetValueOrDefault(); context.SetData(this, counter + 1); return counter == index; }