コード例 #1
0
        public void GetProducts()
        {
            //Arrange
            Mock <IProductRepository> mockProductRepository =
                new Mock <IProductRepository>();

            mockProductRepository.Setup(service => service.GetProducts())
            .Returns(new List <Product>()
            {
                new Product(), new Product()
            });
            IProductApplicationService productsApplicationService = new ProductApplicationService(mockProductRepository.Object);
            //Act
            IList <ProductDto> result = productsApplicationService.GetProducts();

            //Assert
            Assert.IsAssignableFrom <IList <ProductDto> >(result);
        }