public void RideRepository_GetSearchRide() { using (var context = DatabaseFactory.CreateDbContext()) { RideParam searchparam = new RideParam { MinimumThrillFactor = 1 }; RideRepository controller = new RideRepository(context); var rides = controller.SearchRide(searchparam); Assert.Equal(2, rides.Count); } }
public void SearchRide_ShouldReturnMatchedRides() { RideParam searchparam = new RideParam { MinimumThrillFactor = 2 }; // Arrange var mockRideRepository = new Mock <IRideRepository>(); mockRideRepository.Setup(x => x.SearchRide(searchparam)) .Returns(GetTestRides().Where(r => r.ThrillFactor >= searchparam.MinimumThrillFactor).ToList <Ride>()); var controller = new RideService(mockRideRepository.Object); // Act var contentResult = controller.SearchRide(searchparam); // Assert Assert.NotNull(contentResult); Assert.Equal(2, contentResult.Count); }
public List <Ride> SearchRide(RideParam param) { return(_context.Rides.Where(r => r.ThrillFactor >= param.MinimumThrillFactor).ToList <Ride>()); }
public List <Ride> SearchRide(RideParam param) { return(rideRepository.SearchRide(param)); }
public List <Ride> SearchRide(RideParam param) { throw new NotImplementedException(); }