Example #1
0
 public AccountController(UserManager <ApplicationUser> userManager, SignInManager <ApplicationUser> signInManager,
                          ICartRepo cartRepo)
 {
     this.userManager   = userManager;
     this.signInManager = signInManager;
     this.cartRepo      = cartRepo;
 }
 public OrderController(ILoginRepo loginRepo, IOrderRepo orderRepo, ICartRepo cartRepo, IProductRepo productRepo)
 {
     _orderRepo   = orderRepo;
     _loginRepo   = loginRepo;
     _cartRepo    = cartRepo;
     _productRepo = productRepo;
 }
Example #3
0
 public CartController(ICartRepo repo, DiscountGrpcService discountGrpcService, IMapper mapper,
                       IPublishEndpoint publishEndpoint)
 {
     _repo = repo;
     _discountGrpcService = discountGrpcService;
     _mapper          = mapper;
     _publishEndpoint = publishEndpoint;
 }
 /// <summary>
 /// Controller constructor
 /// </summary>
 /// <param name="logger"></param>
 /// <param name="articleRepo"></param>
 /// <param name="userRepo"></param>
 /// <param name="cartRepo"></param>
 /// <param name="transactionRepo"></param>
 public UserController(ILogger <UserController> logger, IArticleRepo articleRepo, IUserRepo userRepo, ICartRepo cartRepo, ITransactionRepo transactionRepo)
 {
     this._userRepo        = userRepo;
     this._articleRepo     = articleRepo;
     this._logger          = logger;
     this._cartRepo        = cartRepo;
     this._transactionRepo = transactionRepo;
 }
 public CartUnitTesting()
 {
     dbFactoryMock = new Mock<IDBContextFactory>();
     fakeShoppingCartDbContext = new FakeShoppingCartDBContext();
     prodcutRepoMock = new Mock<IProductRepo>();
     cartRepo = new CartRepo(prodcutRepoMock.Object, dbFactoryMock.Object );
     dbFactoryMock.Setup(o => o.createDbContext<IShoppingCartDBContext>(It.IsAny<String>()))
         .Returns(fakeShoppingCartDbContext);
 }
 public CartService(ICartRepo cartRepo,
                    ICartItemRepo cartItemRepo,
                    IProductRepo productRepo,
                    SessionService sessionService)
 {
     this.cartRepo       = cartRepo;
     this.cartItemRepo   = cartItemRepo;
     this.productRepo    = productRepo;
     this.sessionService = sessionService;
 }
 public ClientService(UserManager <CustomIdentityUser> usermanager, IEMailService mailService, ICartRepo CartService,
                      IConfiguration configurations, IHttpContextAccessor httpContextAccessor, IMapper mapper, DbContexts dbContexts)
 {
     _UserManager    = usermanager;
     _CartRepo       = CartService;
     _Configurations = configurations;
     _mailService    = mailService;
     _mapper         = mapper;
     _DbContext      = dbContexts;
 }
Example #8
0
 public HomeController(ILogger <HomeController> logger, IProductRepo productRepo,
                       UserManager <ApplicationUser> userManager, SignInManager <ApplicationUser> signInManager,
                       ICartRepo cartRepo, ICartProductRepo cartProductRepo)
 {
     _logger              = logger;
     this.productRepo     = productRepo;
     this.userManager     = userManager;
     this.signInManager   = signInManager;
     this.cartRepo        = cartRepo;
     this.cartProductRepo = cartProductRepo;
 }
Example #9
0
 public LaunchMenu(lacrosseContext context, ICustomerRepo custRepo, IManagerRepo managerRepo, ILocationRepo locRepo, ICartRepo cartRepo)
 {
     this.context          = context;
     this.custRepo         = custRepo;
     this.locRepo          = locRepo;
     this.cartRepo         = cartRepo;
     this.managerRepo      = managerRepo;
     this.customerServices = new CustomerServices(custRepo);
     this.locationServices = new LocationServices(locRepo);
     this.cartServices     = new CartServices(cartRepo);
     this.managerServices  = new ManagerServices(managerRepo);
 }
        public CartUnitTestingDB()
        {

            scope = new TransactionScope(TransactionScopeOption.Required,
                new TransactionOptions {IsolationLevel = IsolationLevel.ReadCommitted},
                TransactionScopeAsyncFlowOption.Enabled);
            dbFactoryMock = new Mock<IDBContextFactory>();
            shoppingCartDbContext = new ShoppingCartDBContext(ConnectionString);
            prodcutRepoMock = new Mock<IProductRepo>();
            cartRepo = new CartRepo(prodcutRepoMock.Object, dbFactoryMock.Object);
            dbFactoryMock.Setup(o => o.createDbContext<IShoppingCartDBContext>(It.IsAny<String>()))
                .Returns(shoppingCartDbContext);
        }
Example #11
0
 public UserController(ICartRepo c, ICartItemRepo CI, IProdRepos p, IUserRepo u, UserManager <AppUser> usrMgr,
                       IUserValidator <AppUser> userValid,
                       IPasswordValidator <AppUser> passValid,
                       IPasswordHasher <AppUser> passwordHash)
 {
     uRepo             = u;
     CIRepo            = CI;
     cRepo             = c;
     pRepo             = p;
     userManager       = usrMgr;
     userValidator     = userValid;
     passwordValidator = passValid;
     passwordHasher    = passwordHash;
 }
Example #12
0
 public ProductDetails2(Customer customer, Sticks stick, lacrosseContext context, ICustomerRepo customerRepo, IInventoryRepo inventoryRepo, IProductRepo productRepo, ICartRepo cartRepo, ICartItemsRepo cartItemsRepo)
 {
     this.customer          = customer;
     this.stick             = stick;
     this.customerRepo      = customerRepo;
     this.productRepo       = productRepo;
     this.cartRepo          = cartRepo;
     this.cartItemsRepo     = cartItemsRepo;
     this.inventoryRepo     = inventoryRepo;
     this.customerServices  = new CustomerServices(customerRepo);
     this.inventoryServices = new InventoryServices(inventoryRepo);
     this.productServices   = new ProductServices(productRepo);
     this.cartServices      = new CartServices(cartRepo);
     this.cartItemServices  = new CartItemServices(cartItemsRepo);
 }
Example #13
0
 public CheckoutMenu(Customer customer, lacrosseContext context, ICustomerRepo customerRepo, ILocationRepo locationRepo, IInventoryRepo inventoryRepo, IProductRepo productRepo, ICartRepo cartRepo, ICartItemsRepo cartItemsRepo, IOrderRepo orderRepo, ILineItemRepo lineItemRepo)
 {
     this.customer          = customer;
     this.customerRepo      = customerRepo;
     this.inventoryRepo     = inventoryRepo;
     this.locationRepo      = locationRepo;
     this.productRepo       = productRepo;
     this.orderRepo         = orderRepo;
     this.cartRepo          = cartRepo;
     this.cartItemsRepo     = cartItemsRepo;
     this.lineItemRepo      = lineItemRepo;
     this.customerServices  = new CustomerServices(customerRepo);
     this.locationServices  = new LocationServices(locationRepo);
     this.inventoryServices = new InventoryServices(inventoryRepo);
     this.productServices   = new ProductServices(productRepo);
     this.cartServices      = new CartServices(cartRepo);
     this.cartItemServices  = new CartItemServices(cartItemsRepo);
     this.orderServices     = new OrderServices(orderRepo);
     this.lineItemServices  = new lineItemServices(lineItemRepo);
 }
        private readonly Guid TESTUSERID = ModelBuilderExtensions.TESTUSERID;  //enkel in development

        public CartsController(CartServicesContext context, ICartRepo cartItemRepo, ICartSender cartSender)
        {
            this.cartRepo   = cartItemRepo;
            this.cartSender = cartSender;
        }
 public ThanksForPurchaseController(IUserRepo userR, ICartRepo cartR)
 {
     usersTable = userR;
     cartTable  = cartR;
 }
Example #16
0
 public CartManager(ICartRepo cartRepo)
 {
     this.cartRepo = cartRepo;
 }
Example #17
0
 public CartService(ICartRepo Repo) : base(Repo)
 {
     _Repo = Repo;
 }
Example #18
0
 public UserDashboardController(IDashboardRepo dashboardRepo, ICartRepo cartRepo)
 {
     _dashboardRepo = dashboardRepo;
     _cartRepo      = cartRepo;
 }
Example #19
0
 public GameController(IUserRepo userR, IGameRepo gameR, ICartRepo cartR)
 {
     usersTable = userR;
     gamesTable = gameR;
     cartTable  = cartR;
 }
Example #20
0
 public CartServices(ICartRepo repo)
 {
     this.repo = repo;
 }
 public CartController(ICartRepo repo, EventBusRabbitMqProducer eventBus, IMapper mapper)
 {
     _eventBus = eventBus;
     _mapper   = mapper;
     _repo     = repo;
 }
Example #22
0
 public CartController(ICartRepo cartRepo, IItemRepo itemRepo)
 {
     _cartRepo = cartRepo;
     _itemRepo = itemRepo;
 }
Example #23
0
 public CartController(IProductRepo productRepo, ICartRepo cartrepo, IMapper mapper)
 {
     _CartRepo    = cartrepo;
     _mapper      = mapper;
     _ProductRepo = productRepo;
 }
Example #24
0
 public OrderController(ICartRepo cartRepo, IStockService stockService)
 {
     _cartRepo     = cartRepo;
     _stockService = stockService;
 }
Example #25
0
 public OrderController()
 {
     _cartRepo     = new CartRepo();
     _stockService = new StockService();
 }
Example #26
0
 public CartController()
 {
     _cartRepo = new CartRepo();
     _itemRepo = new ItemRepo();
 }
Example #27
0
 public UserClientController(IGiftBoxRepo giftRepo, IOrderRepo orderRepo, ICartRepo cartRepo)
 {
     this.giftRepo  = giftRepo;
     this.orderRepo = orderRepo;
     this.cartRepo  = cartRepo;
 }
Example #28
0
 public Login2(IUserValidation service, ICartRepo repo)
 {
     _service = service;
     _repo    = repo;
 }
 //icartrepo
 //public ProductController(IProdRepos r,ICartItemRepo CI )
 //{
 //    pRepo = r;
 //    CIRepo = CI;
 //}
 public ProductController(IProdRepos p, ICartRepo c)
 {
     pRepo = p;
     cRepo = c;
 }
 public CartController(ICartRepo Cart)
 {
     this.CartRepo = Cart;
 }
Example #31
0
 public UserController(ICartRepo c, ICartItemRepo CI, IProdRepos p)
 {
     CIRepo = CI;
     cRepo  = c;
     pRepo  = p;
 }
Example #32
0
        /// <summary>
        /// Public constructor for the mocked repository
        /// </summary>
        /// <param name="carts">optional cart list to mock</param>
        public CartMockRepo(List <Cart> carts = null)
        {
            if (carts != null)
            {
                _cartsMockList = carts;
            }

            var mockRepo = new Mock <ICartRepo>();

            // Mocks the function Get()
            mockRepo.Setup(cartRepo => cartRepo.Get("")).ReturnsAsync(DBOTODTOList(_cartsMockList));

            // Mocks the function Insert()
            mockRepo.Setup(cartRepo => cartRepo.Insert(It.IsAny <DTOCart>())).ReturnsAsync((DTOCart cartModel) =>
            {
                long max = 1;
                if (_cartsMockList.Count() != 0)
                {
                    max = _cartsMockList.Max(c => c.Id) + 1;
                }

                var cart = DTOToDBO(cartModel);
                cart.Id  = max;

                _cartsMockList.Add(cart);

                return(DBOToDTO(cart));
            });

            // Mocks the function Update()
            mockRepo.Setup(cartRepo => cartRepo.Update(It.IsAny <DTOCart>())).ReturnsAsync((DTOCart cartModel) =>
            {
                var result = _cartsMockList.Where(c => c.Id == cartModel.Id);
                if (result.Count() != 1)
                {
                    return(null);
                }

                var cart = result.First();

                cart.ArticleId = cartModel.ArticleId;
                cart.BuyerId   = cartModel.BuyerId;
                cart.Quantity  = cartModel.Quantity;

                return(DBOToDTO(cart));
            });

            // Mocks the function Delete()
            mockRepo.Setup(cartRepo => cartRepo.Delete(It.IsAny <long>())).ReturnsAsync((long i) =>
            {
                var cart = _cartsMockList.Where(c => c.Id == i);
                if (cart.Count() == 1)
                {
                    _cartsMockList.Remove(cart.First());
                    return(true);
                }

                return(false);
            });

            // Mocks the function GetById()
            mockRepo.Setup(cartRepo => cartRepo.GetById(It.IsAny <long>())).Returns((long i) =>
            {
                var count = _cartsMockList.Count(c => c.Id == i);
                if (count != 1)
                {
                    return(null);
                }

                return(DBOToDTOAsync(_cartsMockList.Single(c => c.Id == i)));
            });

            // Mocks the function Count()
            mockRepo.Setup(cartRepo => cartRepo.Count()).ReturnsAsync(_cartsMockList.Count());

            // Mocks the function GetCartByUserId()
            mockRepo.Setup(cartRepo => cartRepo.GetCartByUserId(It.IsAny <long>())).ReturnsAsync((long i) =>
            {
                List <DTOCart> carts = new List <DTOCart>();

                var result = _cartsMockList.Where(c => c.BuyerId == i).ToList();
                foreach (Cart cart in result)
                {
                    carts.Add(DBOToDTO(cart));
                }

                return(carts);
            });

            // Mocks the function GetCartItemByArticleId()
            mockRepo.Setup(cartRepo => cartRepo.GetCartItemByArticleId(It.IsAny <long>())).ReturnsAsync((long i) =>
            {
                var result = _cartsMockList.Find(c => c.ArticleId == i);
                if (result == null)
                {
                    return(null);
                }

                DTOCart cart = DBOToDTO(result);

                return(cart);
            });

            // Mocks the function UserCartAlreadyContains()
            mockRepo.Setup(cartRepo => cartRepo.UserCartAlreadyContains(It.IsAny <long>(), It.IsAny <long>())).ReturnsAsync((long articleId, long buyerId) =>
            {
                var result = _cartsMockList.Find(c => (c.ArticleId == articleId && c.BuyerId == buyerId));
                if (result == null)
                {
                    return(false);
                }

                return(true);
            });

            this._mockRepo = mockRepo.Object;
        }