Exemplo n.º 1
0
        public async Task OnGet_ReturnPaginatedList(decimal PriceFrom,
                                                    decimal PriceTo, string searchString)
        {
            //Arrange
            var mockProductsRep = new Mock <IProductsRepository>();

            mockProductsRep.Setup(_db => _db.GetAllProducts()).Returns(MockProducts.GetAllProductsTest()); //настрока: вызов нужного метода и передача данных
            var pageModel = new CatalogModel(mockProductsRep.Object, new Mock <IMaterialsRepository>().Object, new Mock <IManufacturersRepostory>().Object);

            //Act
            var result = await pageModel.OnGetAsync(PriceFrom, PriceTo, SortState.NameAsc, null, null, 1, searchString);

            //Assert
            Assert.IsType <PaginatedList <Products> >(result);
        }