/// @todo Naming. public static ComplexRelation combine(Relator.Binary binaryRelator, ASimpleRelation s1, ASimpleRelation s2) { Check.Require(s1 != null && s2 != null, "No null arguments!"); ComplexRelation s1_s2; if(binaryRelator == Relator.Binary.AND) s1_s2 = new ComplexRelation(); else s1_s2 = new ComplexRelation(Relator.Binary.OR); s1_s2.addRelata(s1, s2); return s1_s2; }
public void runBeforTest() { titel = "Love"; autor = "Hill"; TITEL = new StringSearch(titel, Track.Property.Titel.ToString(), Titel.Property.Name.ToString()); AUTOR = new StringSearch(autor, Track.Property.Autor.ToString(), Autor.Property.Name.ToString()); AND = new ComplexRelation(); OR = new ComplexRelation(Relator.Binary.OR); }
public void can_searchFor_negativeCriterion() { this.titel = "super"; TITEL = new StringSearch(Relator.Unary.NOT, this.titel, Track.Property.Titel.ToString(), Titel.Property.Name.ToString()); IList<Track> tracks = TrackSearch_Service.getTrackListing(TITEL); foreach(Track track in tracks) { Assert.IsTrue(!Regex.IsMatch(track.Titel.Name, this.titel, RegexOptions.IgnoreCase)); } }
public void can_searchFor() { this.autor = "doof"; this.titel = "bloed"; TITEL = new StringSearch(this.titel, Track.Property.Titel.ToString(), Titel.Property.Name.ToString()); AUTOR = new StringSearch(this.autor, Track.Property.Autor.ToString(), Autor.Property.Name.ToString()); ComplexRelation complexRelation = TrackSearch_Service.combine(Relator.Binary.OR, this.AUTOR, this.TITEL); IList<Track> tracks = TrackSearch_Service.getTrackListing(complexRelation); foreach(Track track in tracks) { Assert.IsTrue( ( Regex.IsMatch(track.Titel.Name, this.titel, RegexOptions.IgnoreCase) || Regex.IsMatch(track.Autor.Name, this.autor, RegexOptions.IgnoreCase) ) ); } }