public GetProductResponse GetProduct(GetProductRequest request) { return new GetProductResponse() { Product = new Product { ProductId = Guid.NewGuid(), Cost = 1.00m, Description = "Product description" } }; }
public GetProductResponse GetProduct(GetProductRequest request) { var product = ProductRepository.GetProduct(request.ProductId); Mapper.CreateMap<DataLayer.Product, ServiceLayer.Product>(); var serviceProduct = Mapper.Map<DataLayer.Product, ServiceLayer.Product>(product); return new GetProductResponse() { Product = serviceProduct }; }
public void ProductCatalog_ShouldGetProduct() { var logic = new ProductCatalogLogic(new MemoryProductRespository()); var request = new GetProductRequest { ProductId = Guid.NewGuid() }; var response = logic.GetProduct(request); Assert.IsNotNull(response.Product); Assert.IsTrue(response.Product.ProductId == request.ProductId); }