Exemplo n.º 1
0
        public async void GetAllTest()
        {
            var repo = new Mock <ITripRepository> ();
            var uow  = new Mock <IUnitOfWork> ();

            string lineID            = "Line:1";
            string pathID            = "Path:1";
            string tripDepartureTime = "20:12:10";

            var trip  = new Trip(lineID, pathID, tripDepartureTime);
            var trips = new List <Trip> ()
            {
                trip
            };

            var tripDTO  = new TripDTO(trip.Id.AsGuid(), new LineId(lineID), new PathId(pathID), tripDepartureTime);
            var tripsDTO = new List <TripDTO> ()
            {
                tripDTO
            };

            repo.Setup(_ => _.GetAllAsync()).ReturnsAsync(trips);

            var service = new TripService(repo.Object, uow.Object);

            var actual = await service.GetAll();

            Assert.Equal(tripsDTO, actual);
        }
 // GET: api/TripsApi
 public IQueryable <Trip> GetTrips()
 {
     return(tripService.GetAll().AsQueryable());
 }
Exemplo n.º 3
0
 public HttpResponse All()
 {
     return(View(_tripService.GetAll()));
 }