public void use_multiple_predicates() { var composite = new CompositePredicate <string>(); composite += x => x.StartsWith("a"); composite += x => x.EndsWith("x"); composite.MatchesAll("a").ShouldBeFalse(); composite.MatchesAll("x").ShouldBeFalse(); composite.MatchesAll("abx").ShouldBeTrue(); }
public void registered_predicates_are_used() { var composite = new CompositePredicate <string>(); composite.MatchesAll("a").ShouldBeTrue(); composite.MatchesAll("b").ShouldBeTrue(); composite += x => x == "a"; composite.MatchesAll("a").ShouldBeTrue(); composite.MatchesAll("b").ShouldBeFalse(); }
public void VisitRoute(IRouteDefinition route, BehaviorChain chain) { if (_behaviorFilters.MatchesAll(chain) && _routeFilters.MatchesAll(route)) { _actions.Do(route, chain); } }
public void no_predicates_means_that_it_always_true() { var composite = new CompositePredicate<string>(); composite.MatchesAll("a").ShouldBeTrue(); composite.MatchesAll("b").ShouldBeTrue(); composite.MatchesAll("c").ShouldBeTrue(); composite.MatchesAll("d").ShouldBeTrue(); composite.MatchesAll("e").ShouldBeTrue(); composite.MatchesAll("f").ShouldBeTrue(); composite.MatchesAll("g").ShouldBeTrue(); }
public void no_predicates_means_that_it_always_true() { var composite = new CompositePredicate <string>(); composite.MatchesAll("a").ShouldBeTrue(); composite.MatchesAll("b").ShouldBeTrue(); composite.MatchesAll("c").ShouldBeTrue(); composite.MatchesAll("d").ShouldBeTrue(); composite.MatchesAll("e").ShouldBeTrue(); composite.MatchesAll("f").ShouldBeTrue(); composite.MatchesAll("g").ShouldBeTrue(); }
public void VisitBehavior(BehaviorChain chain) { if (!_filters.MatchesAll(chain)) { return; } var matchesDescriptions = _filters.GetDescriptionOfMatches(chain).Join(", "); if (matchesDescriptions == string.Empty) { matchesDescriptions = "(no filters defined)"; } chain.Calls.Each(call => call.Trace("Visiting: {0}. Matched on filters [{1}]", _reasonToVisit, matchesDescriptions)); _actions.Do(chain); }
public void registered_predicates_are_used() { var composite = new CompositePredicate<string>(); composite.MatchesAll("a").ShouldBeTrue(); composite.MatchesAll("b").ShouldBeTrue(); composite += x => x == "a"; composite.MatchesAll("a").ShouldBeTrue(); composite.MatchesAll("b").ShouldBeFalse(); }
public void use_multiple_predicates() { var composite = new CompositePredicate<string>(); composite += x => x.StartsWith("a"); composite += x => x.EndsWith("x"); composite.MatchesAll("a").ShouldBeFalse(); composite.MatchesAll("x").ShouldBeFalse(); composite.MatchesAll("abx").ShouldBeTrue(); }