title: Automapper not mapping List<int>
body: <p>I am mapping two objects using AutoMapper but it is not mapping List of <code>int</code>.</p>
  
  <p>Here is what I am doing:</p>
  
  <pre><code>Public class A
  {
      public int a{get;set;}
      public string b{get;set;}
      public List&lt;int&gt; ints{get;set;}
  }
  
  Public class B
  {
      public int a{get;set;}
      public string b{get;set;}
      public List&lt;int&gt; ints{get;set;}
  }
  
  public class MappingService
  {
  
      public object MapBToA(B b)
     {
          Mapper.CreateMap&lt;B,A&gt;();
          return  Mapper.Map&lt;B,A&gt;(b);
     }
  }
  </code></pre>
  
  <p>When we call the mapping function it is returning a type  of <code>object</code> but ints is always empty.</p>
  
  <h2>Edited</h2>
  
  <p>Question With Real Classes</p>
  
  <pre><code>public class SearchRawInput
  {
      public SearchRawInput()
      {
          PageNo = 1;
      }
      public string City { get; set; }
      public string Segment1 { get; set; }
      public string Segment2 { get; set; }
      public TargetAgeGroup? TargetAge { get; set; }
      public List&lt;int&gt; CategoryIds { get; set; }
      public List&lt;int&gt; SubCategoryIds { get; set; }
      public List&lt;int&gt; LocationIds { get; set; }
      public List&lt;int&gt; LocationGroupIds { get; set; }
      public DateTime? StartDate { get; set; }
      public DateTime? EndDate { get; set; }
      public decimal? StartPrice { get; set; }
      public decimal? EndPrice { get; set; }
      public string SearchQuery { get; set; }
      public int? PageNo { get; set; }
  
  }
  
  public class ClassSearchInputViewModel
  {
      public ClassSearchInputViewModel()
      {
          PageSize = 12;
      }
      public UrlSeoProcessingResult UrlSeoProcessingResult { get; set; }
      public TargetAgeGroup TargetAge { get; set; }
      public List&lt;int&gt; CategoryIds { get; set; }
      public List&lt;int&gt; SubCategoryIds { get; set; }
      public List&lt;int&gt; LocationIds { get; set; }
      public List&lt;int&gt; LocationGroupIds { get; set; }
      public DateTime? StartDate { get; set; }
      public DateTime? EndDate { get; set; }
      public decimal? StartPrice { get; set; }
      public decimal? EndPrice { get; set; }
      public ClassDifficultyLevel DifficultyLevel { get; set; }
      public string SearchQuery { get; set; }
      public int PageNo { get; set; }
      public int PageSize { get; set; }
  }
  
  public class SegmentToUrlSeoProcessingResultResolver : ValueResolver&lt;SearchRawInput, UrlSeoProcessingResult&gt;
  {
      protected  override UrlSeoProcessingResult ResolveCore(SearchRawInput source)
      {
          var processor =new UrlProcessor();
          if (source.Segment1 != null &amp;&amp; source.Segment2 != null)
          {
              return processor.Process( (source.Segment1.Trim() + "/" + source.Segment2.Trim()).Trim(), source.City);
          }
          else if (source.Segment1 == null &amp;&amp; source.Segment2 == null)
          {
              return processor.Process("", source.City);
          }
          else
          {
              if (source.Segment1 != null)
              {
                  return processor.Process( (source.Segment1.Trim()).Trim(),source.City);
              }
              else 
              {
                  return processor.Process(  source.Segment2.Trim(),source.City);
              }
  
          }
  
      }
  }
  
  
  public ClassSearchInputViewModel ClassSearchRawInputToClassSearchInput(SearchRawInput classSearchRawInput)
      {
          var classSearchInput = Mapper.Map&lt;SearchRawInput, ClassSearchInputViewModel&gt;(classSearchRawInput);
          return classSearchInput;
      }
  
  Mapper.CreateMap&lt;SearchRawInput,ClassSearchInputViewModel&gt;()
      .ForMember(dest =&gt; dest.UrlSeoProcessingResult, opt =&gt; opt.ResolveUsing&lt;SegmentToUrlSeoProcessingResultResolver&gt;());
  </code></pre>
  
  <p>above is the complete code and when i call  ClassSearchRawInputToClassSearchInputmethod it will returl me object of ClassSearchInputViewModel but it returns locationids with 0 not of items</p>
  
  <p>Here is my unit test for the same</p>
  
  <pre><code>    [Isolated]
      [TestMethod]
      public void ClassSearchRawInputToClassSearchInputViewModel_Test()
      {
  
          var urlProcessor = new SegmentToUrlSeoProcessingResultResolver();
  
          AutoMapperConfiguration.Configure();
          IMapperService mapper = new MapperService();
          int[] genericStringArray = {1, 2, 3};
          var searchRawInput = new SearchRawInput()
              {
                  City = "Mumbai",
                  Segment1 = "Dance",
                  Segment2 = "Salsa",
                  CategoryIds =  genericStringArray.ToList(),
                  StartDate = DateTime.Now,
                  EndDate = DateTime.Now,
                  LocationGroupIds = genericStringArray.ToList(),
                  LocationIds = genericStringArray.ToList(),
                  StartPrice = genericStringArray[0],
                  EndPrice = 2132123,
                  SearchQuery = "Search Query",
                  SubCategoryIds = genericStringArray.ToList(),
                  TargetAge = TargetAgeGroup.Kids
              };
  
          Isolate.NonPublic.WhenCalled(urlProcessor, "ResolveCore", new SearchRawInput()
              {
                  City = "Mumbai",
                  Segment1 = "Dance",
                  Segment2 = "Salsa",
                  CategoryIds =  genericStringArray.ToList(),
                  StartDate = DateTime.Now,
                  EndDate = DateTime.Now,
                  LocationGroupIds = genericStringArray.ToList(),
                  LocationIds = genericStringArray.ToList(),
                  StartPrice = genericStringArray[0],
                  EndPrice = 2132123,
                  SearchQuery = "Search Query",
                  SubCategoryIds = genericStringArray.ToList(),
                  TargetAge = TargetAgeGroup.Kids
              }).WillReturn(new UrlSeoProcessingResult()
                                                      {
                                                          LocationGroupId = 1,
                                                          SubCategoryId = 2,
                                                          IsError = false,
                                                          Type = SegmentType.GroupSubCategory
                                                      });
          var classSearchInput = mapper.ClassSearchRawInputToClassSearchInput(searchRawInput);
          Assert.AreEqual(TargetAgeGroup.Kids, classSearchInput.TargetAge, "Age is not mapped properly");
          Assert.AreEqual(3,classSearchInput.LocationIds.Count,"Location not mapped properly");
          Assert.AreEqual(3,classSearchInput.CategoryIds.Count,"Category is not mapped correctly");
      }
  </code></pre>