示例#1
0
 static Presenter3()
 {
     ISearchItemDto dto1 = new SearchItem_Like_Dto(Track.Property.Interpret);
     ISearchItemDto dto2 = new SearchItem_Like_Dto(Track.Property.Interpret);
     ISearchItemDto dto3 = new SearchItem_Like_Dto(Track.Property.Interpret);
     DEFAULT_job = new SearchJobDto(new ISearchItemDto[3] { dto1, dto2, dto3 });
 }
 public void can_getRecentSearchJobs2()
 {
     ISearchItemDto searchAtom = new SearchItem_Like_Dto(Relator.Unary.IS,Track.Property.Interpret, String.Empty);
     IList<ISearchItemDto> searchAtoms = new List<ISearchItemDto>(new ISearchItemDto[] { searchAtom });
     ISearchJobDto searchJob = new SearchJobDto(searchAtoms);
     HttpSessionStateTask.getRecentSearchJobs(context.Session).Add(searchJob);
     Assert.AreEqual(1, HttpSessionStateTask.getRecentSearchJobs(context.Session).Count);
 }
 public void can_construct3()
 {
     ISearchItemDto dto = new SearchItem_Like_Dto(Relator.Unary.IS, Track.Property.Interpret, "a");
     ISearchItemDto dto2 = new SearchItem_Like_Dto(Relator.Unary.IS, Track.Property.Titel, "a");
     ISearchItemDto between = new SearchItem_Between_Dto(Relator.Unary.IS, Track.Property.Year, "1999", "2000");
     ISearchItemDto between2 = new SearchItem_Between_Dto(Relator.Unary.IS, Track.Property.Bpm, "100", "120");
     this.dto = new SearchJobDto(new ISearchItemDto[] { dto, dto2, between, between2 });
     Assert.AreEqual(4, this.dto.SearchItemList.Count);
     Assert.AreEqual(Relator.Binary.AND, this.dto.BinaryRelator);
 }
 private IList<ISearchJobDto> setupJobs()
 {
     ISearchItemDto dto1 = new SearchItem_Like_Dto(Relator.Unary.IS, Track.Property.Interpret, "a");
     ISearchItemDto dto2 = new SearchItem_Like_Dto(Relator.Unary.IS, Track.Property.Titel, "a");
     ISearchItemDto dto3 = new SearchItem_Between_Dto(Relator.Unary.IS, Track.Property.Year, "1999", "2000");
     ISearchItemDto dto4 = new SearchItem_Between_Dto(Relator.Unary.IS, Track.Property.Bpm, "100", "120");
     ISearchJobDto job1 = new SearchJobDto(new ISearchItemDto[] { dto1, dto3 });
     ISearchJobDto job2 = new SearchJobDto(new ISearchItemDto[] { dto2, dto4 });
     ISearchJobDto job3 = new SearchJobDto(new ISearchItemDto[] { dto1, dto4 });
     ISearchJobDto job4 = new SearchJobDto(new ISearchItemDto[] { dto2, dto3 });
     return new List<ISearchJobDto>(new ISearchJobDto[4] { job1, job2, job3, job4 });
 }
        public void can_do()
        {
            ISearchItemDto dto = new SearchItem_Like_Dto(Relator.Unary.IS, Track.Property.Interpret, "a");
            ISearchItemDto dto2 = new SearchItem_Like_Dto(Relator.Unary.IS, Track.Property.Titel, "a");
            ISearchItemDto between = new SearchItem_Between_Dto(Relator.Unary.IS, Track.Property.Year, "1999", "2000");
            ISearchItemDto between2 = new SearchItem_Between_Dto(Relator.Unary.IS, Track.Property.Bpm, "100", "120");
            ISearchJobDto job = new SearchJobDto(new ISearchItemDto[] { dto, dto2, between, between2 });

            SearchJobTask task = new SearchJobTask();
            ARelation aRelation = task.job2Relation(job);

            Assert.AreEqual(4, aRelation.Relata.Count);
        }
示例#6
0
 private ARelation convert( SearchItem_Like_Dto dto)
 {
     if(dto.TrackProperty == Track.Property.Ending) {
         return SearchItem_Service.getSimpleRelation(
             dto.UnaryRelator,
             (Ending.Attribute)Enum.Parse(typeof(Ending.Attribute), Regex.Replace(dto.SearchPhrase[0], @"\s", ""), true));
     }
     else {
         return SearchItem_Service.getSimpleRelation(
             dto.UnaryRelator,
             dto.SearchPhrase[0],
             dto.TrackProperty);
     }
 }
 private IList<ISearchJobDto> setupJobs()
 {
     ISearchItemDto dto1 = new SearchItem_Like_Dto(Relator.Unary.IS, Track.Property.Interpret, "a");
     ISearchItemDto dto2 = new SearchItem_Like_Dto(Relator.Unary.IS, Track.Property.Titel, "a");
     ISearchJobDto job1 = new SearchJobDto(new ISearchItemDto[] { dto1, dto2 });
     return new List<ISearchJobDto>(new ISearchJobDto[1] { job1 });
 }
        public void can_manageSearchItemDtos()
        {
            ISearchItemDto item = new SearchItem_Like_Dto(Relator.Unary.IS, Track.Property.Interpret, "missy");
            ISearchItemDto item2 = new SearchItem_Like_Dto(Relator.Unary.IS, Track.Property.Titel, "love");
            ISearchItemDto item3 = new SearchItem_Between_Dto(Relator.Unary.IS, Track.Property.Bpm, "100", "120");

            StateBagTask.getSearchItemDtos(this.viewState).Add(item);
            Assert.AreEqual(1, StateBagTask.getSearchItemDtos(this.viewState).Count);
            StateBagTask.getSearchItemDtos(this.viewState).Add(item2);
            Assert.AreEqual(2, StateBagTask.getSearchItemDtos(this.viewState).Count);
            StateBagTask.getSearchItemDtos(this.viewState).Add(item3);
            Assert.AreEqual(3, StateBagTask.getSearchItemDtos(this.viewState).Count);
            StateBagTask.getSearchItemDtos(this.viewState).Remove(item);
            Assert.AreEqual(2, StateBagTask.getSearchItemDtos(this.viewState).Count);
        }
 public void can_getSearchItemDtos2()
 {
     ISearchItemDto item = new SearchItem_Like_Dto(Relator.Unary.IS, Track.Property.Interpret, String.Empty);
     StateBagTask.getSearchItemDtos(this.viewState).Add(item);
     Assert.AreEqual(1, StateBagTask.getSearchItemDtos(this.viewState).Count);
 }
 public void can_getCurrentSearchJobDto2()
 {
     ISearchItemDto searchItem = new SearchItem_Like_Dto(Relator.Unary.IS, Track.Property.Interpret, String.Empty);
     StateBagTask.getCurrentSearchJob(this.viewState).SearchItemList.Add(searchItem);
     Assert.AreEqual(1, StateBagTask.getCurrentSearchJob(this.viewState).SearchItemList.Count);
 }