< Summary

Information
Class: CoWorkingApp.API.Infrastructure.Adapters.AutoMapperAdapter
Assembly: CoWorkingApp.API
File(s): H:\Vicentico\Proyectos\CoWorkingApp Project\CoWorkingApp\CoWorkingApp.API\Infrastructure\Adapters\AutoMapperAdapter.cs
Line coverage
100%
Covered lines: 10
Uncovered lines: 0
Coverable lines: 10
Total lines: 46
Line coverage: 100%
Branch coverage
100%
Covered branches: 2
Total branches: 2
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Cyclomatic complexity Line coverage
.ctor(...)100%2100%
Map(...)100%1100%
Map(...)100%1100%

File(s)

H:\Vicentico\Proyectos\CoWorkingApp Project\CoWorkingApp\CoWorkingApp.API\Infrastructure\Adapters\AutoMapperAdapter.cs

#LineLine coverage
 1using AutoMapper;
 2using CoWorkingApp.Core.Application.Contracts.Adapters;
 3
 4namespace CoWorkingApp.API.Infrastructure.Adapters
 5{
 6    /// <summary>
 7    /// Adaptador de AutoMapper que implementa la interfaz IMapperAdapter.
 8    /// </summary>
 9    public class AutoMapperAdapter : IMapperAdapter
 10    {
 11        private readonly IMapper _mapper;
 12
 13        /// <summary>
 14        /// Constructor de la clase AutoMapperAdapter.
 15        /// </summary>
 16        /// <param name="mapper">Instancia de IMapper proporcionada por AutoMapper.</param>
 417        public AutoMapperAdapter(IMapper mapper)
 418        {
 419            _mapper = mapper ?? throw new ArgumentNullException();
 320        }
 21
 22        /// <summary>
 23        /// Mapea un objeto de origen a un objeto de destino.
 24        /// </summary>
 25        /// <typeparam name="TSource">Tipo de objeto de origen.</typeparam>
 26        /// <typeparam name="TDestination">Tipo de objeto de destino.</typeparam>
 27        /// <param name="source">Objeto de origen a ser mapeado.</param>
 28        /// <returns>Objeto de destino mapeado.</returns>
 29        public TDestination Map<TSource, TDestination>(TSource source)
 130        {
 131            return _mapper.Map<TSource, TDestination>(source);
 132        }
 33
 34        /// <summary>
 35        /// Mapea una colección de objetos de origen a una colección de objetos de destino.
 36        /// </summary>
 37        /// <typeparam name="TSource">Tipo de objeto de origen.</typeparam>
 38        /// <typeparam name="TDestination">Tipo de objeto de destino.</typeparam>
 39        /// <param name="source">Colección de objetos de origen a ser mapeados.</param>
 40        /// <returns>Colección de objetos de destino mapeados.</returns>
 41        public IEnumerable<TDestination> Map<TSource, TDestination>(IEnumerable<TSource> source)
 142        {
 143            return _mapper.Map<IEnumerable<TSource>, IEnumerable<TDestination>>(source);
 144        }
 45    }
 46}