public async Task <List <TripDTO> > GetAll() { var tripList = await this._repo.GetAllAsync(); var tripDTOlist = new List <TripDTO> (); foreach (var trip in tripList) { TripDTO tripDTO = _mapper.DomainToDTO(trip); tripDTOlist.Add(tripDTO); } foreach (var tripDTO in tripDTOlist) { tripDTO.nodePassageListDTO.Sort(delegate(NodePassageDTO x, NodePassageDTO y){ var xSec = TimeUtils.fromStringToSec(x.passageTime); var ySec = TimeUtils.fromStringToSec(y.passageTime); return(xSec.CompareTo(ySec)); }); } return(tripDTOlist); }
public void DTOtoDomain() { var mapper = new TripMapper(); string lineID = "Line:1"; string pathID = "Path:1"; string tripDepartureTime = "20:12:10"; var trip = new Trip(lineID, pathID, tripDepartureTime); var expected = new TripDTO(trip.Id.AsGuid(), new LineId(lineID), new PathId(pathID), tripDepartureTime); var actual = mapper.DomainToDTO(trip); Assert.True(expected.Equals(actual)); }