public void GetProductData_Should_Get_Data() { // Setup int productId = _fixture.Create <int>(); ProductData returnData = _fixture.Build <ProductData>().With(r => r.ProductId, productId).Create(); _mockRetailProductRepo .Setup(repo => repo.GetProduct(productId)) .Returns(returnData); _mockPricingRepo .Setup(repo => repo.GetProductPrice(productId)) .Returns(returnData.Price); // Act var result = _retailProductManager.GetProductData(productId); // Assert _mockRetailProductRepo.Verify(repo => repo.GetProduct(productId), Times.Once); _mockPricingRepo.Verify(repo => repo.GetProductPrice(productId), Times.Once); }
public async Task <Messages.ReadProductDataResponse> Get(Messages.ReadProductData request) { try { var response = new Messages.ReadProductDataResponse(); response.ProductData = _retailProductManager.GetProductData(request.ProductId); return(response); } catch (Exception ex) { //Log exceptions here - check logging assumptions in readme throw; } }