Hi,
Anyone got any experience with running NCrunch on a project with lots of calls to
AutoMapper? We have lots of fixtures that need AutoMapper to have been initialized -- something like
Code:AutoMapperConfig.Initialize(configForATest);
or
Code:AutoMapperConfig.Initialize(configForAnotherTest);
Now, AutoMapper is basically a big global object, re-configured every time you call .Initialize(). Although I've tried to make my tests run serially, some tests fail on a first pass because they trip up with other tests; However, I can get all the tests to pass by repeatedly clicking 'Run all visible tests here' -- every time, a few more pass, until they all pass.
This doesn't occur in the Visual Studio Test Explorer window.
I've set these variables which I'd hope would have made my tests totally serial, but it doesn't seem to help;
Code:
General Settings.CPU cores assigned to NCrunch: 0
General Settings.Max number of processing threads: 1
General Settings.Max number of test runner processes to pool: 1
Anyone suggest anything to get NCrunch and AutoMapper to play nicely with each other?
Steve
PS: Failures generally look like this;
Code:NCrunch: This test was executed on server '(local)'
AutoMapperConfig - Creating mappings
An exception was thrown in the Task Environment: AutoMapper.AutoMapperMappingException:
Mapping types:
XXXXXXXXXXX -> ICollection`1
XXXXXXXXXXX.XXXXXXXXXXX.XXXXXXXXXXX -> System.Collections.Generic.ICollection`1[[XXXXXXXXXXX.XXXXXXXXXXX.XXXXXXXXXXX.XXXXXXXXXXX, XXXXXXXXXXX.XXXXXXXXXXX, Version=1.66.5679.15956, Culture=neutral, PublicKeyToken=null]]
Destination path:
XXXXXXXXXXX.XXXXXXXXXXX.XXXXXXXXXXX
Source value:
XXXXXXXXXXX.XXXXXXXXXXX.XXXXXXXXXXX ---> System.ArgumentNullException: Cannot be null
Parameter name: root
at Ninject.ResolutionExtensions.GetResolutionIterator(IResolutionRoot root, Type service, Func`2 constraint, IEnumerable`1 parameters, Boolean isOptional, Boolean isUnique)
at Ninject.ResolutionExtensions.Get(IResolutionRoot root, Type service, IParameter[] parameters)
at XXXXXXXXXXX.App_Start.AutoMapperConfig.<>c__DisplayClass5.<CreateMappingsWithInjection>b__1(Type type) in XXXXXXXXXXX\App_Start\AutoMapperConfig.cs:line 65
at AutoMapper.MappingExpression`2.<>c__DisplayClass3a`1.<BuildCtor>b__39(ResolutionContext context) in c:\dev\AutoMapper\src\AutoMapper\Internal\MappingExpression.cs:line 554
at AutoMapper.DeferredInstantiatedResolver.Resolve(ResolutionResult source) in c:\dev\AutoMapper\src\AutoMapper\Internal\DeferredInstantiatedResolver.cs:line 16
at AutoMapper.PropertyMap.<ResolveValue>b__6(ResolutionResult current, IValueResolver resolver) in c:\dev\AutoMapper\src\AutoMapper\PropertyMap.cs:line 127
...