{"action":"created","issue":{"url":"https://api.github.com/repos/aspnetboilerplate/aspnetboilerplate/issues/1272","repository_url":"https://api.github.com/repos/aspnetboilerplate/aspnetboilerplate","labels_url":"https://api.github.com/repos/aspnetboilerplate/aspnetboilerplate/issues/1272/labels{/name}","comments_url":"https://api.github.com/repos/aspnetboilerplate/aspnetboilerplate/issues/1272/comments","events_url":"https://api.github.com/repos/aspnetboilerplate/aspnetboilerplate/issues/1272/events","html_url":"https://github.com/aspnetboilerplate/aspnetboilerplate/issues/1272","id":170589605,"number":1272,"title":"AutoMapper AutoMapperMappingException with Unit Tests - Missing Mappings","user":{"login":"psyvision","id":1932948,"avatar_url":"https://avatars.githubusercontent.com/u/1932948?v=3","gravatar_id":"","url":"https://api.github.com/users/psyvision","html_url":"https://github.com/psyvision","followers_url":"https://api.github.com/users/psyvision/followers","following_url":"https://api.github.com/users/psyvision/following{/other_user}","gists_url":"https://api.github.com/users/psyvision/gists{/gist_id}","starred_url":"https://api.github.com/users/psyvision/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/psyvision/subscriptions","organizations_url":"https://api.github.com/users/psyvision/orgs","repos_url":"https://api.github.com/users/psyvision/repos","events_url":"https://api.github.com/users/psyvision/events{/privacy}","received_events_url":"https://api.github.com/users/psyvision/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/aspnetboilerplate/aspnetboilerplate/labels/problem","name":"problem","color":"eb9460"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/aspnetboilerplate/aspnetboilerplate/milestones/57","html_url":"https://github.com/aspnetboilerplate/aspnetboilerplate/milestones/v0.11.0","labels_url":"https://api.github.com/repos/aspnetboilerplate/aspnetboilerplate/milestones/57/labels","id":1822841,"number":57,"title":"v0.11.0","description":"","creator":{"login":"hikalkan","id":1210527,"avatar_url":"https://avatars.githubusercontent.com/u/1210527?v=3","gravatar_id":"","url":"https://api.github.com/users/hikalkan","html_url":"https://github.com/hikalkan","followers_url":"https://api.github.com/users/hikalkan/followers","following_url":"https://api.github.com/users/hikalkan/following{/other_user}","gists_url":"https://api.github.com/users/hikalkan/gists{/gist_id}","starred_url":"https://api.github.com/users/hikalkan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hikalkan/subscriptions","organizations_url":"https://api.github.com/users/hikalkan/orgs","repos_url":"https://api.github.com/users/hikalkan/repos","events_url":"https://api.github.com/users/hikalkan/events{/privacy}","received_events_url":"https://api.github.com/users/hikalkan/received_events","type":"User","site_admin":false},"open_issues":22,"closed_issues":4,"state":"open","created_at":"2016-06-13T07:29:52Z","updated_at":"2016-08-12T12:44:43Z","due_on":null,"closed_at":null},"comments":8,"created_at":"2016-08-11T07:57:59Z","updated_at":"2016-08-12T13:33:30Z","closed_at":null,"body":"I have created a unit test project that mirrors the sample test project in the questions-answers repository.  It uses xUnit, Effort and ABP 0.10.3.0\r\n\r\nI have four unit tests in a class, that all test a service.  When running them, they all execute the same piece of code as part of the test:\r\n\r\n```\r\n            lookupService.PostCreate(new LookupViewModel\r\n            {\r\n                LookupType = LookupType.AuditCategory,\r\n                Name = \"General\"\r\n            });\r\n```\r\n\r\nFor one test (that runs first) this is okay, but it fails for the others throwing an AutoMapperMappingException.  If I run (or debug) the tests individually they are all okay.  It seems essentially the same problem as:\r\n\r\nhttps://github.com/AutoMapper/AutoMapper/issues/1500\r\n\r\nMy test module is defined as:\r\n\r\n```\r\n    [DependsOn(\r\n        typeof(AbpAutoMapperModule),\r\n        typeof(AbpTestBaseModule),\r\n        typeof(ApplicationModule),\r\n        typeof(DataModule))]\r\n    public class TestModule : AbpModule\r\n    {\r\n        public override void Initialize()\r\n        {\r\n            // Added to see if this resolves the Exception - but it doesn't\r\n            Profiles.Configure();\r\n        }\r\n    }\r\n```\r\n\r\nThe mapping is between LookupViewModel and an Entity.  The LookupViewModel has this on it:\r\n\r\n```\r\n[AutoMapTo(\r\n        typeof(ActionCategory)\r\n)]\r\n```\r\n\r\nWhen debugging and calling:\r\n\r\n```\r\nMapper.GetAllTypeMaps().Length\r\n```\r\n\r\nI can see that on the first test there are 170 odd mappings, on subsequent tests there are only 60 odd.  It appears that those defined using the AutoMap attribute are not being configured on subsequent tests as the 60 odd are explicitly defined mappings."},"comment":{"url":"https://api.github.com/repos/aspnetboilerplate/aspnetboilerplate/issues/comments/239447181","html_url":"https://github.com/aspnetboilerplate/aspnetboilerplate/issues/1272#issuecomment-239447181","issue_url":"https://api.github.com/repos/aspnetboilerplate/aspnetboilerplate/issues/1272","id":239447181,"user":{"login":"hikalkan","id":1210527,"avatar_url":"https://avatars.githubusercontent.com/u/1210527?v=3","gravatar_id":"","url":"https://api.github.com/users/hikalkan","html_url":"https://github.com/hikalkan","followers_url":"https://api.github.com/users/hikalkan/followers","following_url":"https://api.github.com/users/hikalkan/following{/other_user}","gists_url":"https://api.github.com/users/hikalkan/gists{/gist_id}","starred_url":"https://api.github.com/users/hikalkan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hikalkan/subscriptions","organizations_url":"https://api.github.com/users/hikalkan/orgs","repos_url":"https://api.github.com/users/hikalkan/repos","events_url":"https://api.github.com/users/hikalkan/events{/privacy}","received_events_url":"https://api.github.com/users/hikalkan/received_events","type":"User","site_admin":false},"created_at":"2016-08-12T13:33:30Z","updated_at":"2016-08-12T13:33:30Z","body":"OK, looking forward for your tests."}}
{"actor":{"display_login":"hikalkan"}}