예제 #1
0
        public async Task ShoudGetAll()
        {
            var productCategory = new CategoryProductBuilder()
                                  .WithName("celular")
                                  .Construct();


            var productLine = new ProductLineBuilder().
                              WithProductCategoryId(Guid.NewGuid())
                              .WithName("nokia 780")
                              .WhithCategory(productCategory)
                              .Construct();

            var productLine2 = new ProductLineBuilder().
                               WithProductCategoryId(Guid.NewGuid())
                               .WithName("nokia 7080")
                               .WhithCategory(productCategory)
                               .Construct();

            var productLineResponse = new ProductLineResponseModel
            {
                Name = "nokia 780",
                ProductCategoryName = productCategory.CategoryName.ToString()
            };

            var productsList = new List <ProductLine>();

            productsList.Add(productLine);
            productsList.Add(productLine2);

            _productLineRepository.GetAll().Returns(productsList);

            var result = await _productLineService.GetAll();

            result[0].Should().BeEquivalentTo(productLineResponse);
        }
 public async Task <IList <ProductLineResponseModel> > GetAll()
 {
     return(await _productLineService.GetAll());
 }