/// <summary> /// This method searches for all the records that contain the string (searchString) and returns them as a RecordList object . /// /*This could easily be changed to it returns a List<Record> but I think returning a RecordList object is much helpful right now.*/ /// USE THIS METHOD TO PRINT THE NEW RECORD LIST AFTER SEARCHING!!! /// </summary> /// <param name="searchString"></param> /// <returns></returns> public RecordList searchRecord(string searchString) { List <Record> searchedList = recordList.filterList(searchString); RecordList cloneList = new RecordList(searchedList); return(cloneList); //Needs some things updated in list and form first. }
public void testFilteringRecords() { List <Record> tempList = new List <Record>(); Record r7 = new Record(new RecordInfoBuilder() .withRecordName("Daniel12") .withArtist("TEST") .withYear(1999) .withRecordCondition(RecordCondition.Good) .withSleeveCondition(RecordCondition.Good) .withPrice(200.0) .withID(99) .build()); Record r8 = new Record(new RecordInfoBuilder() .withRecordName("Daniel13") .withArtist("TEST") .withYear(1999) .withRecordCondition(RecordCondition.Good) .withSleeveCondition(RecordCondition.Good) .withPrice(200.0) .withID(99) .build()); rList.addRecord(r7); rList.addRecord(r8); tempList.Add(r7); Assert.ReferenceEquals(tempList, rList.filterList("12")); tempList.Remove(r7); tempList.Add(r8); Assert.ReferenceEquals(tempList, rList.filterList("13")); }