Example #1
0
        public void Init()
        {
            this.carAdsRepoMock         = new Mock <IEfRepostory <CarAd> >();
            this.carBrandsRepoMock      = new Mock <IEfRepostory <CarBrand> >().Object;
            this.carModelsRepoMock      = new Mock <IEfRepostory <CarModel> >().Object;
            this.carFeatureServicesMock = new Mock <ICarFeatureServices>().Object;
            this.unitOfWorkMocked       = new Mock <IEfUnitOfWork>().Object;

            this.carAds = new List <CarAd>
            {
                new CarAd {
                    Title = "Awesome car!"
                },
                new CarAd {
                    Title = "Wohoo. Can be yours"
                },
                new CarAd {
                    Title = "Be fast!"
                },
            };

            this.expectedCarAd = new CarAd
            {
                Title = "Wohooo"
            };

            carAds.Add(expectedCarAd);

            var carAdsQuarable = this.carAds.AsQueryable();

            this.carAdsRepoMock.Setup(x => x.All).Returns(carAdsQuarable);
        }
 public void Init()
 {
     this.carAdsRepoMock         = new Mock <IEfRepostory <CarAd> >().Object;
     this.carBrandsRepoMock      = new Mock <IEfRepostory <CarBrand> >().Object;
     this.carModelsRepoMock      = new Mock <IEfRepostory <CarModel> >().Object;
     this.carFeatureServicesMock = new Mock <ICarFeatureServices>().Object;
     this.unitOfWorkMocked       = new Mock <IEfUnitOfWork>().Object;
 }
        public CarAdServices(
            IEfRepostory <CarAd> carAdsRepo,
            IEfRepostory <CarBrand> carBrandsRepo,
            IEfRepostory <CarModel> carModelsRepo,
            ICarFeatureServices carFeatureServices,
            IEfUnitOfWork unitOfWork)
        {
            Guard.WhenArgument(carAdsRepo, "carAdsRepo").IsNull().Throw();
            Guard.WhenArgument(carBrandsRepo, "carBrandsRepo").IsNull().Throw();
            Guard.WhenArgument(carModelsRepo, "carModelsRepo").IsNull().Throw();
            Guard.WhenArgument(carFeatureServices, "carFeatureServices").IsNull().Throw();
            Guard.WhenArgument(unitOfWork, "unitOfWork").IsNull().Throw();

            this.carsAdsRepo        = carAdsRepo;
            this.carBrandsRepo      = carBrandsRepo;
            this.carModelsRepo      = carModelsRepo;
            this.carFeatureServices = carFeatureServices;
            this.unitOfWork         = unitOfWork;
        }
        public void Init()
        {
            this.carAdsRepoMock         = new Mock <IEfRepostory <CarAd> >();
            this.carBrandsRepoMock      = new Mock <IEfRepostory <CarBrand> >().Object;
            this.carModelsRepoMock      = new Mock <IEfRepostory <CarModel> >().Object;
            this.carFeatureServicesMock = new Mock <ICarFeatureServices>().Object;
            this.unitOfWorkMocked       = new Mock <IEfUnitOfWork>();

            this.carAds = new List <CarAd>
            {
                new CarAd {
                    Title = "Awesome car!"
                },
                new CarAd {
                    Title = "Wohoo. Can be yours"
                },
                new CarAd {
                    Title = "Be fast!"
                },
            }.AsQueryable();
        }
        public CarAdController(
            ICarAdServices carAdServices,
            ICarBrandServices brandServices,
            ICarModelServices carModelServices,
            ICarFeatureServices carFeatureServices,
            ITownServices townServices,
            IMapper mapper)
        {
            Guard.WhenArgument(carAdServices, "carAdServices").IsNull().Throw();
            Guard.WhenArgument(brandServices, "brandServices").IsNull().Throw();
            Guard.WhenArgument(carModelServices, "carModelServices").IsNull().Throw();
            Guard.WhenArgument(carFeatureServices, "carFeatureServices").IsNull().Throw();
            Guard.WhenArgument(townServices, "townServices").IsNull().Throw();
            Guard.WhenArgument(mapper, "mapper").IsNull().Throw();

            this.carAdServices      = carAdServices;
            this.brandServices      = brandServices;
            this.carModelServices   = carModelServices;
            this.carFeatureServices = carFeatureServices;
            this.townServices       = townServices;
            this.mapper             = mapper;
        }