public void ConvertToDto_ProductBadgeNotNull_ReturnSameBadges() { ProductBadge ProductBadge = MockProductBadge(); ProductBadgeDto ProductBadgeDto = ProductBadge.ConvertToDto(); Assert.Equal(ProductBadge.Badges, ProductBadgeDto.Badges); }
public async Task <OperationResult <ProductBadgeDto> > GetByProductAsync(string productId) { ProductBadge badge = await _productBadgeRepository.GetByProduct(new Product { Id = productId }); if (badge is null) { return(OperationResult <ProductBadgeDto> .NotFound()); } return(OperationResult <ProductBadgeDto> .Success(badge.ConvertToDto())); }