public void Init()
        {
            this.userRepo            = new Mock <IEfRepostory <User> >();
            this.carAdServicesMocked = new Mock <ICarAdServices>().Object;
            this.unitOfWorkMocked    = new Mock <IEfUnitOfWork>().Object;

            this.users = new List <User>()
            {
                new User {
                    UserName = "******"
                },
                new User {
                    UserName = "******"
                },
                new User {
                    UserName = "******"
                },
            };

            this.expectedUser = new User
            {
                UserName = "******"
            };

            users.Add(expectedUser);

            var usersAsQuarable = this.users.AsQueryable();

            this.userRepo.Setup(x => x.All).Returns(usersAsQuarable);
        }
        public HomeController(ICarAdServices carAdServices, IMapper mapper)
        {
            Guard.WhenArgument(carAdServices, "carAdServices").IsNull().Throw();
            Guard.WhenArgument(mapper, "mapper").IsNull().Throw();

            this.carAdServices = carAdServices;
            this.mapper        = mapper;
        }
Example #3
0
        public UserServices(IEfRepostory <User> usersRepo, ICarAdServices carAdServices, IEfUnitOfWork unitOfWork)
        {
            Guard.WhenArgument(usersRepo, "usersRepo").IsNull().Throw();
            Guard.WhenArgument(carAdServices, "carAdServices").IsNull().Throw();
            Guard.WhenArgument(unitOfWork, "unitOfWork").IsNull().Throw();

            this.usersRepo     = usersRepo;
            this.carAdServices = carAdServices;
            this.unitOfWork    = unitOfWork;
        }
        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;
        }
Example #5
0
        public void Init()
        {
            this.userRepo            = new Mock <IEfRepostory <User> >();
            this.carAdServicesMocked = new Mock <ICarAdServices>().Object;
            this.unitOfWorkMocked    = new Mock <IEfUnitOfWork>().Object;

            this.users = new List <User>()
            {
                new User {
                    UserName = "******"
                },
                new User {
                    UserName = "******"
                },
                new User {
                    UserName = "******"
                },
            };

            this.expectedUser = new User
            {
                UserName = "******",
                CarAds   = new List <CarAd>
                {
                    new CarAd {
                        Title = "The best car"
                    },
                    new CarAd {
                        Title = "It is amazing"
                    }
                }
            };

            users.Add(expectedUser);

            var usersAsQuarable = this.users.AsQueryable();

            this.userRepo.Setup(x => x.AllAndDeleted).Returns(usersAsQuarable);
        }
Example #6
0
 public void Init()
 {
     this.userRepoMock        = new Mock <IEfRepostory <User> >().Object;
     this.carAdServicesMocked = new Mock <ICarAdServices>().Object;
     this.unitOfWorkMocked    = new Mock <IEfUnitOfWork>().Object;
 }