Ejemplo n.º 1
0
 public ParticipantScoresDataService(
     IEfGenericRepository <ParticipantScore> participantScores,
     IParticipantsDataService participantsData)
 {
     this.participantScores = participantScores;
     this.participantsData  = participantsData;
 }
Ejemplo n.º 2
0
 public UsersForTest(IEfGenericRepository <Movies> movies, IEfGenericRepository <Genres> genresRepo,
                     IEfGenericRepository <Comments> commentsRepo, IEfGenericRepository <Users> userRepo,
                     IEfGenericRepository <Likes> likesRepo, IEfGenericRepository <Dislikes> dislikesRepo, IUoW saver)
     : base(movies, genresRepo, commentsRepo, userRepo, likesRepo, dislikesRepo, saver)
 {
     this.SaveChangesCalled = 0;
 }
Ejemplo n.º 3
0
 public InventoryService(IEfUnitOfWork unitOfWork, IMappingProvider mapper, IEfGenericRepository <Inventory> inventories)
 {
     Guard.WhenArgument(unitOfWork, "unitOfWork").IsNull().Throw();
     Guard.WhenArgument(mapper, "mapper").IsNull().Throw();
     Guard.WhenArgument(inventories, "inventories").IsNull().Throw();
     this.inventories = inventories;
 }
Ejemplo n.º 4
0
        public AllFeedbacksController(IFeedbacksService feedbacks, IEfGenericRepository <ApplicationUser> repoUser)
            : base(repoUser)
        {
            Guard.WhenArgument(feedbacks, "feedbacks").IsNull().Throw();

            this.feedbacks = feedbacks;
        }
Ejemplo n.º 5
0
 public QuestionService(IEfGenericRepository <Question> questionRepo, IMappingProvider mapper, ISaver saver, IRandomProvider random, IAnswerService answerService)
     : base(mapper, saver, random)
 {
     Guard.WhenArgument(questionRepo, "questionRepo").IsNull().Throw();
     Guard.WhenArgument(answerService, "answerService").IsNull().Throw();
     this.questionRepo  = questionRepo;
     this.answerService = answerService;
 }
Ejemplo n.º 6
0
        public UserService(IEfGenericRepository <User> userRepository, IUnitOfWork unitOfWork)
        {
            Guard.WhenArgument(userRepository, "userRepository").IsNull().Throw();
            Guard.WhenArgument(unitOfWork, "unitOfWork").IsNull().Throw();

            this.userRepository = userRepository;
            this.unitOfWork     = unitOfWork;
        }
Ejemplo n.º 7
0
        public ArticleService(IEfGenericRepository <Article> articleRepository, IUnitOfWork unitOfWork)
        {
            Guard.WhenArgument(articleRepository, "articleRepository").IsNull().Throw();
            Guard.WhenArgument(unitOfWork, "unitOfWork").IsNull().Throw();

            this.articleRepository = articleRepository;
            this.unitOfWork        = unitOfWork;
        }
Ejemplo n.º 8
0
        public PlaceService(IEfGenericRepository <Place> placeRepository, IUnitOfWork unitOfWork)
        {
            Guard.WhenArgument(placeRepository, "placeRepository").IsNull().Throw();
            Guard.WhenArgument(unitOfWork, "unitOfWork").IsNull().Throw();

            this.placeRepository = placeRepository;
            this.unitOfWork      = unitOfWork;
        }
Ejemplo n.º 9
0
        public void ThrowArgumentNullException_WhenPassedRepositoryIsNull()
        {
            // Arrange
            IEfGenericRepository <User> mockedRepository = null;

            // Act & Assert
            Assert.Throws <ArgumentException>(() => new UsersService(mockedRepository));
        }
Ejemplo n.º 10
0
 public VoteServiceTest(IEfGenericRepository <Movies> movies, IEfGenericRepository <Genres> genresRepo,
                        IEfGenericRepository <Comments> commentsRepo, IEfGenericRepository <Users> userRepo,
                        IEfGenericRepository <Likes> likesRepo, IEfGenericRepository <Dislikes> dislikesRepo, IUoW saver)
     : base(movies, genresRepo, commentsRepo, userRepo, likesRepo, dislikesRepo, saver)
 {
     this.GetCurrentUserCalled = 0;
     this.SaveChangesCalled    = 0;
     this.GetMovieCount        = 0;
 }
        public CarsService(IEfGenericRepository <Car> carRepo)
        {
            if (carRepo == null)
            {
                throw new ArgumentException("The car repo should not be null!");
            }

            this.carRepo = carRepo;
        }
        public UsersService(IEfGenericRepository <User> userRepo)
        {
            if (userRepo == null)
            {
                throw new ArgumentException("The user repo shold not be null!");
            }

            this.userRepo = userRepo;
        }
Ejemplo n.º 13
0
 public ProductService(IEfUnitOfWork unitOfWork, IEfGenericRepository <Product> products, IMappingProvider mapper)
 {
     Guard.WhenArgument(unitOfWork, "unitofwork").IsNull().Throw();
     Guard.WhenArgument(products, "GenRepo").IsNull().Throw();
     Guard.WhenArgument(mapper, "mapper").IsNull().Throw();
     this.unitOfWork = unitOfWork;
     this.products   = products;
     this.mapper     = mapper;
 }
Ejemplo n.º 14
0
        public OrderService(IEfUnitOfWork unitOfWork, IMappingProvider mapper, IEfGenericRepository <Order> orders)
        {
            Guard.WhenArgument(unitOfWork, "unitOfWork").IsNull().Throw();
            Guard.WhenArgument(mapper, "mapper").IsNull().Throw();
            Guard.WhenArgument(orders, "orders").IsNull().Throw();

            this.unitOfWork = unitOfWork;
            this.mapper     = mapper;
            this.orders     = orders;
        }
Ejemplo n.º 15
0
        public CountryService(
            IEfGenericRepository <Country> countryRepository,
            IUnitOfWork unitOfWork)
        {
            Guard.WhenArgument(countryRepository, "countryRepository").IsNull().Throw();
            Guard.WhenArgument(unitOfWork, "unitOfWork").IsNull().Throw();

            this.countryRepository = countryRepository;
            this.unitOfWork        = unitOfWork;
        }
Ejemplo n.º 16
0
 public TestService(IEfGenericRepository <Test> testRepo, IEfGenericRepository <Category> categoryRepo, IMappingProvider mapper, ISaver saver, IRandomProvider random, IQuestionService questionService)
     : base(mapper, saver, random)
 {
     Guard.WhenArgument(testRepo, "testRepo").IsNull().Throw();
     Guard.WhenArgument(categoryRepo, "categoryRepo").IsNull().Throw();
     Guard.WhenArgument(questionService, "questionService").IsNull().Throw();
     this.testRepo        = testRepo;
     this.categoryRepo    = categoryRepo;
     this.questionService = questionService;
 }
Ejemplo n.º 17
0
 public AddressService(IEfUnitOfWork unitOfWork, IMappingProvider mapper, IUserService userService, IEfGenericRepository <Address> addresses)
 {
     Guard.WhenArgument(unitOfWork, "unitOfWork").IsNull().Throw();
     Guard.WhenArgument(mapper, "mapper").IsNull().Throw();
     Guard.WhenArgument(userService, "userService").IsNull().Throw();
     Guard.WhenArgument(addresses, "addresses").IsNull().Throw();
     this.unitOfWork  = unitOfWork;
     this.mapper      = mapper;
     this.userService = userService;
     this.addresses   = addresses;
 }
Ejemplo n.º 18
0
        public void ThrowArgumentNullExceptionWithExpectedMessage_WhenPassedRepositoryIsNull()
        {
            // Arrange
            IEfGenericRepository <User> mockedRepository = null;

            // Act
            var expectedMessage = Assert.Throws <ArgumentException>(() => new UsersService(mockedRepository));

            // Assert
            Assert.IsTrue(expectedMessage.Message.Contains("null"));
        }
Ejemplo n.º 19
0
 public BankCardService(IEfUnitOfWork unitOfWork, IMappingProvider mapper, IUserService userService, IEfGenericRepository <BankCard> bankCards)
 {
     Guard.WhenArgument(unitOfWork, "unitOfWork").IsNull().Throw();
     Guard.WhenArgument(mapper, "mapper").IsNull().Throw();
     Guard.WhenArgument(userService, "userService").IsNull().Throw();
     Guard.WhenArgument(bankCards, "bankCards").IsNull().Throw();
     this.unitOfWork  = unitOfWork;
     this.mapper      = mapper;
     this.userService = userService;
     this.bankCards   = bankCards;
 }
Ejemplo n.º 20
0
 public UserService(IMappingProvider mapper, IHashingPassword hashing, IEfUnitOfWork unitOfWork, IEfGenericRepository <User> users)
 {
     Guard.WhenArgument(mapper, "mapper").IsNull().Throw();
     Guard.WhenArgument(hashing, "hashing").IsNull().Throw();
     Guard.WhenArgument(unitOfWork, "unitOfWork").IsNull().Throw();
     Guard.WhenArgument(users, "userRepo").IsNull().Throw();
     this.hashing    = hashing;
     this.unitOfWork = unitOfWork;
     this.mapper     = mapper;
     this.users      = users;
 }
Ejemplo n.º 21
0
 public DataBaseService(IEfGenericRepository <Movies> movies, IEfGenericRepository <Genres> genresRepo,
                        IEfGenericRepository <Comments> commentsRepo, IEfGenericRepository <Users> userRepo,
                        IEfGenericRepository <Likes> likesRepo, IEfGenericRepository <Dislikes> dislikesRepo, IUoW saver)
 {
     this.moviesRepo   = movies;
     this.genresRepo   = genresRepo;
     this.commentsRepo = commentsRepo;
     this.userRepo     = userRepo;
     this.likesRepo    = likesRepo;
     this.dislikesRepo = dislikesRepo;
     this.saver        = saver;
 }
Ejemplo n.º 22
0
        public EfFancyData(IFancyDbContext context, IEfGenericRepository <Item> items, IEfGenericRepository <Order> orders, IEfGenericRepository <User> users)
        {
            Validator.ValidateNullArgument(context, "context");
            Validator.ValidateNullArgument(items, "items");
            Validator.ValidateNullArgument(orders, "orders");
            Validator.ValidateNullArgument(users, "users");

            this.context = context;
            this.items   = items;
            this.orders  = orders;
            this.users   = users;
        }
Ejemplo n.º 23
0
        public CustomerService(IEfGenericRepository <Customer> customerRepository, IEfGenericRepository <Order> orderRepository)
        {
            if (customerRepository == null)
            {
                throw new ArgumentException("The customer repository should not be null!");
            }

            if (orderRepository == null)
            {
                throw new ArgumentException("The order repository should not be null!");
            }

            this.customerRepository = customerRepository;
            this.orderRepository    = orderRepository;
        }
Ejemplo n.º 24
0
        public void TestInit()
        {
            kernel       = DependencyInjectionConfig.CreateKernel();
            context      = kernel.Get <IMoviesContext>();
            movies       = new EfGenericRepository <Movies>(context);
            genresRepo   = new EfGenericRepository <Genres>(context);
            commentsRepo = new EfGenericRepository <Comments>(context);
            userRepo     = new EfGenericRepository <Users>(context);
            likesRepo    = new EfGenericRepository <Likes>(context);
            dislikesRepo = new EfGenericRepository <Dislikes>(context);
            saver        = new UoW(context);

            context.Genres.Add(genre);
            context.SaveChanges();
        }
Ejemplo n.º 25
0
 public UserService(IIdentity identity, IEfGenericRepository <ApplicationUser> usersRepo)
 {
     this.currentIdentity = identity;
     this.usersRepo       = usersRepo;
 }
Ejemplo n.º 26
0
        public TopicsService(IEfGenericRepository <Topic> topics)
        {
            Guard.WhenArgument(topics, "topics").IsNull().Throw();

            this.topics = topics;
        }
 public SubmissionTypesDataService(IEfGenericRepository <SubmissionType> submissionTypes) =>
 this.submissionTypes = submissionTypes;
Ejemplo n.º 28
0
 public ExamGroupsDataService(IEfGenericRepository <ExamGroup> examGroups) =>
 this.examGroups = examGroups;
Ejemplo n.º 29
0
        public SupplementsController(ISupplementsService supplements, IDropDownListPopulator populator, IEfGenericRepository <ApplicationUser> repoUser)
            : base(repoUser)
        {
            Guard.WhenArgument(supplements, "supplements").IsNull().Throw();
            Guard.WhenArgument(populator, "populator").IsNull().Throw();

            this.supplements = supplements;
            this.populator   = populator;
        }
Ejemplo n.º 30
0
        public AllCommentsController(ITopicsService topics, ICommentsService comments, IEfGenericRepository <ApplicationUser> repoUser)
            : base(repoUser)
        {
            Guard.WhenArgument(topics, "topics").IsNull().Throw();
            Guard.WhenArgument(comments, "comments").IsNull().Throw();

            this.topics   = topics;
            this.comments = comments;
        }