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
                };
        }
Ejemplo n.º 3
0
        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);
        }