Example #1
0
 public ProductsController(
     BasketContext context,
     ILogger <ProductsController> logger,
     IMapper mapper)
 {
     _context = context;
     _logger  = logger;
     _mapper  = mapper;
 }
Example #2
0
        public int createBasketId(BasketContext context)
        {
            int newid = random.Next();

            while (checkId(context, newid))
            {
                newid = random.Next();
            }

            context.Baskets.Add(new Models.Basket(newid, DateTime.Now));
            context.SaveChanges();

            return(newid);
        }
Example #3
0
        private BasketContext GetContextWithData()
        {
            var options = new DbContextOptionsBuilder <BasketContext>()
                          .UseInMemoryDatabase(Guid.NewGuid().ToString())
                          .Options;
            var context = new BasketContext(options);

            // add seeds
            context.Products.Add(new ProductModel()
            {
                SKU = "P111", Description = "Surface Phone", Price = 100, Quantity = 100
            });
            context.Products.Add(new ProductModel()
            {
                SKU = "P112", Description = "Surface Pro 1", Price = 120, Quantity = 200
            });
            context.Products.Add(new ProductModel()
            {
                SKU = "P113", Description = "Surface Pro 2", Price = 140, Quantity = 200
            });
            context.Products.Add(new ProductModel()
            {
                SKU = "P111", Description = "Windows10 Pro", Price = 123, Quantity = 600
            });

            context.Baskets.Add(new BasketRequest()
            {
                ClientId = "A111", Quantity = 5, SKU = "P111", TotalPrice = 500
            });
            context.Baskets.Add(new BasketRequest()
            {
                ClientId = "A111", Quantity = 1, SKU = "P112", TotalPrice = 200
            });
            context.Baskets.Add(new BasketRequest()
            {
                ClientId = "A115", Quantity = 1, SKU = "P112", TotalPrice = 200
            });
            context.SaveChanges();

            return(context);
        }
Example #4
0
        public void BuyAProduct()
        {
            //Arrange
            var minpriceValueToSet = 100;
            var maxpriceValueToSet = 2000;
            var name = "‘ол≥о";

            var booksResultsPage = new FilterPage(driver);
            var SingleBookPage   = new GoodsItemPage(driver);
            var Basket           = new BasketPage(driver);
            var Checkout         = new CheckoutPage(driver);

            //Act
            FilteringContext.FilterByPriceRange(booksResultsPage, minpriceValueToSet, maxpriceValueToSet);
            FilteringContext.ClickCheckbox(booksResultsPage, name);
            ResultSetContext.BuyElement(booksResultsPage, 0);
            BasketContext.ProceedToCheckout(Basket);
            CheckoutContext.InputReceiverData(Checkout, "Testik", "0980000001", "*****@*****.**");
            //Assert
            GoodStateVerificationContext.VerifyMakeOrderIsClickable(Checkout);
        }
Example #5
0
        public void Buy()
        {
            //Arrange
            var minpriceValueToSet = 100;
            var maxpriceValueToSet = 2000;
            var name            = "ю-аю-аю-цю-кю-лю-цю";
            int HowCanlongIwait = 15000;

            var booksResultsPage = new FilterPage(driver);
            var SingleBookPage   = new GoodsItemPage(driver);
            var Basket           = new BasketPage(driver);
            var Checkout         = new CheckoutPage(driver);

            //Act
            FilteringContext.FilterByPriceRange(booksResultsPage, minpriceValueToSet, maxpriceValueToSet, HowCanlongIwait);
            FilteringContext.ClickCheckbox(booksResultsPage, name, HowCanlongIwait);
            ResultSetContext.BuyElement(booksResultsPage, 0, HowCanlongIwait);
            BasketContext.ProceedToCheckout(Basket, HowCanlongIwait);
            CheckoutContext.InputReceiverData(Checkout, HowCanlongIwait);//modification with volid date
            //Assert
            VerificationContext.VerifyMakeOrderIsClickable(Checkout);
        }
Example #6
0
 public QueueHandler(BasketContext context)
 {
     _context = context;
 }
 public BasketItemsController(BasketContext context, IConfiguration configuration, RedisCacheClient redisCacheClient)
 {
     _context          = context;
     _configuration    = configuration;
     _redisCacheClient = redisCacheClient;
 }
Example #8
0
 public EfGenericRepository(BasketContext context)
 {
     DbContext = context;
     Table     = DbContext.Set <T>();
 }
Example #9
0
 public HttpController(BasketContext context)
 {
     _context = context;
 }
 public BasketService(BasketContext context)
 {
     _context = context;
 }
 public HomeController(ILogger <HomeController> logger, BasketContext basketContext)
 {
     _logger = logger;
     context = basketContext;
 }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="context">The basket database context</param>
 public BasketAPIController(BasketContext context)
 {
     _context = context;
 }
Example #13
0
 public BasketRepository(BasketContext context)
 {
     this.context = context;
 }
Example #14
0
 public ProductController(BasketContext context)
 {
     _context = context;
 }
 public ProductPriceChangedIntegrationEventHandler(BasketContext basketContext)
 {
     //_logger = logger ?? throw new ArgumentNullException(nameof(logger));
     _basketContext = basketContext ?? throw new ArgumentNullException(nameof(basketContext));
 }
Example #16
0
        public bool checkId(BasketContext context, int id)
        {
            var basket = from row in context.Baskets where row.Id == id select row;

            return(basket.Count() > 0);
        }
Example #17
0
 public BasketRepository(BasketContext appDbContext)
 {
     AppDbContext = appDbContext ?? throw new ArgumentNullException(nameof(appDbContext));
 }
Example #18
0
 public CartItemsController(BasketContext context)
 {
     _context = context;
 }
Example #19
0
 public BasketController(BasketContext basketContext)
 {
     _basketContext = basketContext ?? throw new ArgumentNullException(nameof(basketContext));
 }
 public EventController(BasketContext context)
 {
     _context = context;
 }
Example #21
0
 public BasketController(IConfiguration configuration, BasketContext context)
 {
     this.configuration = configuration;
     this._context      = context;
 }
Example #22
0
 public EfGenericRepository()
 {
     DbContext = new BasketContext();
     Table     = DbContext.Set <T>();
 }