Example #1
0
        public void ReturnsAllProductsGivenFromRepository()
        {
            InitFields();
            ProductsDTOFacade productsDTOFacade = new ProductsDTOFacade(
                productsRepositoryMock.Object, GetMapper(), priorityUserProductsRespositoryMock.Object);
            int productsForUserCount       = productsRepositoryMock.Object.GetAllProductsForUser(firstUserGuid).Count();
            int sortedProductsForUserCount = productsDTOFacade.GetAllProductsForUser(firstUserGuid).Count();

            Assert.Equal(productsForUserCount, sortedProductsForUserCount);
        }
Example #2
0
        public void OrdersByCountDescending()
        {
            InitFields();
            ProductsDTOFacade productsDTOFacade = new ProductsDTOFacade(
                productsRepositoryMock.Object, GetMapper(), priorityUserProductsRespositoryMock.Object);
            ProductDTO top1product;

            user2product4.Count = 2;
            user2product5.Count = 1;
            top1product         = productsDTOFacade.GetAllProductsForUser(secondUserGuid).First();
            Assert.Equal(top1product.Id, product4.Id);
            user2product4.Count = 1;
            user2product5.Count = 2;
            top1product         = productsDTOFacade.GetAllProductsForUser(secondUserGuid).First();
            Assert.Equal(top1product.Id, product5.Id);
        }
Example #3
0
 public ProductsController(FoodNetDbContext context, ProductsDTOFacade productsDTOFacade)
 {
     _context           = context;
     _productsDTOFacade = productsDTOFacade;
 }