Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9116343
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T04:39:00+00:00 2026-06-17T04:39:00+00:00

I do want to test the custom logic in the CreateMap method. I do

  • 0

I do want to test the custom logic in the CreateMap method. I do NOT want to test whether the mapping exist at all for some types.

How can I do that or what are the classes that I need to know. I am grateful for every hint The document about. Automapper unit testing seems very rare…

public class UnitProfile : Profile
{
   protected override void Configure()
   {
      // Here I create my maps with custom logic that needs to be tested

    CreateMap<Unit, UnitTreeViewModel>()
         .ForMember(dest => dest.IsFolder, o => o.MapFrom(src => src.UnitTypeState == UnitType.Folder ? true : false));

    CreateMap<CreateUnitViewModel, Unit>()
         .ForMember(dest => dest.UnitTypeState, o => o.MapFrom(src => (UnitType)Enum.ToObject(typeof(UnitType), src.SelectedFolderTypeId)));
   }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T04:39:01+00:00Added an answer on June 17, 2026 at 4:39 am

    This is the documentation for configuration testing: http://docs.automapper.org/en/stable/Configuration-validation.html

    You can see an example of it here: https://stackoverflow.com/a/14150006/1505426

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to test a MVC action method which accpets a custom class parameter
I'm posting this for those that still use PrototypeJS and want to test custom
For a custom object, I want to test two conditions. The first is whether
I am trying to write some Unit Tests to test some custom NSOperations that
I'm writing a unit test for a custom model binder (MVC 3) and want
I want to test some QAbstractListModels I already implemented, is it better to use
I want to define a custom widget, which contains some other controls and has
Currently if I want to test a user control, I add my custom tags
I have written a custom test harness in Python (existing stuff was not a
I'm trying to unit test a custom model binder - specifically, I want to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.