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);
        }
Esempio n. 4
0
 private ARelation convert( SearchItem_Between_Dto dto)
 {
     if(dto.TrackProperty == Track.Property.Bpm || dto.TrackProperty == Track.Property.Year)
         return new Between_Int(
             dto.UnaryRelator,
             int.Parse(dto.SearchPhrase[0]),
             int.Parse(dto.SearchPhrase[1]),
             dto.TrackProperty.ToString(),
             Track.getChildPropertyAsString(dto.TrackProperty));
     else
         return new Between_String(
             dto.UnaryRelator,
             dto.SearchPhrase[0],
             dto.SearchPhrase[1],
             dto.TrackProperty.ToString(),
             Track.getChildPropertyAsString(dto.TrackProperty));
 }
        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);
        }