示例#1
0
        public void AllShouldReturnTheCountOfAllProductsInTheDatabase()
        {
            var productsRepository = new Mock <IRepository <Product> >();

            productsRepository.Setup(r => r.All()).Returns(new List <Product>()
            {
                new Product(),
                new Product(),
                new Product()
            }.AsQueryable());

            var service = new ProductsService(productsRepository.Object, null);

            Assert.Equal(3, service.All().Count());
        }
 public async Task <IActionResult> All([FromQuery] PaginationOptions options)
 {
     return(Ok(await _service.All(options)));
 }
        public void AllShouldReturnEmptyCollection()
        {
            var allProducts = _productsService.All().ToList();

            Assert.Empty(allProducts);
        }