Example #1
0
        public async void GetByLineId()
        {
            var tripServiceMock = new Mock <ITripService> ();
            var pathServiceMock = new Mock <IPathService> ();

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

            var trip = new Trip(lineID, pathID, tripDepartureTime);

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

            var line = new LineId(lineID);

            tripServiceMock.Setup(_ => _.GetTripsByLineID(line)).ReturnsAsync(tripsDTO);

            var controller = new TripController(tripServiceMock.Object, pathServiceMock.Object);

            var actual = await controller.GetByLineId(lineID);

            Assert.Equal(tripsDTO, actual.Value);
        }