/// <summary> /// Aetzend! /// </summary> /// <param name="job"></param> /// <returns></returns> /// <remarks> /// Wozu diese Konvertierung? Davon abgesehen das ARelation lange vor(!) ISearchItemDto da war... /// </remarks> public ARelation job2Relation(ISearchJobDto job) { ComplexRelation relation = new ComplexRelation(job.BinaryRelator); foreach(ASearchItemDto item in job.SearchItemList) { if(item.HasNoSearchPhrase) { continue; } if( item is SearchItem_Between_Dto) relation.addRelata(this.convert(item as SearchItem_Between_Dto)); else relation.addRelata(this.convert(item as SearchItem_Like_Dto)); } return relation; }
public void can_getTrackListing_by_Titel_by_ComplexRelation_and_Autor_by_ComplexRelation() { ComplexRelation searchPattern = new ComplexRelation(); ComplexRelation complex1 = new ComplexRelation(); ComplexRelation complex2 = new ComplexRelation(); complex1.addRelata(this.TITEL); searchPattern.addRelata(complex1); complex2.addRelata(this.AUTOR); searchPattern.addRelata(complex2); IList<Track> trackListing = TrackSearch_Service.getTrackListing(searchPattern); this.showResult(trackListing); this.showCount(trackListing); foreach(Track track in trackListing) { Assert.IsTrue(Regex.IsMatch(track.Titel.Name, titel, RegexOptions.IgnoreCase)); Assert.IsTrue(Regex.IsMatch(track.Autor.Name, autor, RegexOptions.IgnoreCase)); } }
public void can_getTrackListing_by_Titel_and_Autor_AND_Titel_or_Autor() { AND.addRelata(TITEL, AUTOR); OR.addRelata(TITEL, AUTOR); ComplexRelation root = new ComplexRelation(); root.addRelata(AND, OR); IList<Track> trackListing = TrackSearch_Service.getTrackListing(root); this.showResult(trackListing); this.showCount(trackListing); foreach(Track track in trackListing) { Assert.IsTrue( ( Regex.IsMatch(track.Titel.Name, titel, RegexOptions.IgnoreCase) && Regex.IsMatch(track.Autor.Name, autor, RegexOptions.IgnoreCase) ) && ( Regex.IsMatch(track.Titel.Name, titel, RegexOptions.IgnoreCase) || Regex.IsMatch(track.Autor.Name, autor, RegexOptions.IgnoreCase) ) ); } }