示例#1
0
        public void Get_Calls_ProductById(ProductDto productDto)
        {
            var mockRepo = new Mock<IRepository>();

            var sut = new ProductsService
            {
                Repository = mockRepo.Object
            };

            var response = sut.Get(productDto);

            mockRepo.Verify(a => a.ProductById(productDto.Id), Times.AtLeastOnce());
        }
示例#2
0
        public void Get_Calls_PagedProducts(ProductsDto productsDto, List<Product> products)
        {
            var mockRepo = new Mock<IRepository>();

            mockRepo.Setup(a => a.PagedProducts(It.IsAny<int>(), It.IsAny<int>()))
                .Returns(products);

            var sut = new ProductsService
            {
                Repository = mockRepo.Object
            };

            var response = sut.Get(productsDto);

            mockRepo.Verify(a => a.PagedProducts(It.IsAny<int>(), It.IsAny<int>()), Times.AtLeastOnce());
        }