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);
            }
        }
示例#2
0
        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);
        }
示例#3
0
 public List <Ride> SearchRide(RideParam param)
 {
     return(_context.Rides.Where(r => r.ThrillFactor >= param.MinimumThrillFactor).ToList <Ride>());
 }
示例#4
0
 public List <Ride> SearchRide(RideParam param)
 {
     return(rideRepository.SearchRide(param));
 }
示例#5
0
 public List <Ride> SearchRide(RideParam param)
 {
     throw new NotImplementedException();
 }