Exemple #1
0
        public async Task ShouldReturnPricesIncreasedBy20Percent()
        {
            //
            var products = new List <Product>
            {
                new Product {
                    ProductId = "1", Description = "Desc1", Name = "p1", UnitPrice = 100.0
                }
            };

            Mock <IProductRepository> productRepoMock = new Mock <IProductRepository>();

            productRepoMock.Setup(repo => repo.GetAllAsync())
            .ReturnsAsync(products);

            ProductDxos productDxos = new ProductDxos();

            var handlr = new GetProductsHandler(productRepoMock.Object, productDxos, new NullLogger <GetProductsHandler>());

            GetProductsQuery queryObj = new GetProductsQuery();

            var productDtos = await handlr.Handle(queryObj, CancellationToken.None);

            Assert.AreEqual(120.0, productDtos[0].Price);
        }
Exemple #2
0
 public void SetUp()
 {
     _productsRepository = new Mock <IProductsRepository>();
     _getProductsHandler = new GetProductsHandler(_productsRepository.Object);
 }