Automapper error when running MSTest from command line

758 Views Asked by At

I'm using AutoMapper 3.0.0 (.net40) in my project and I have MS Test unit tests. All my tests run fine when I run the tests directly from Visual Studio 2012. But when I run the same unit tests from command line using MSTest.exe the test fails with the following error

Test method Expressions.Tests.MappingTests.TestEvaluateFlatExpression threw exception: System.PlatformNotSupportedException: This type is not supported on this platform IMapperRegistry

Here is the stack trace from the failed unit tests.

   at AutoMapper.Internal.PlatformAdapter.Resolve[T](Boolean throwIfNotFound)
   at AutoMapper.Mapper.<.cctor>b__0()
   at AutoMapper.Internal.LazyFactory.LazyImpl`1.get_Value()
   at AutoMapper.Mapper.CreateMap[TSource,TDestination]()
   at Expressions.Evaluator.ExpressionUIMapper.Init() in c:\..\ExpressionUIMapper.cs:line 19
   at Expressions.Evaluator.ExpressionUIMapper..ctor() in c:\..\ExpressionUIMapper.cs:line 30
   at Expressions.Tests.MappingTests.TestEvaluateFlatExpression() in c:\..\MappingTests.cs:line 58

All the projects are .net 4.0 and I'm using MSTest.exe that comes with VS 2012. I'm running the test using

MSTest /testcontainer:Expressions.Tests.dll /detail:errormessage /detail:errorstacktrace

Is there any other parameter that I need to pass on to MSTest that I'm missing?

0

There are 0 best solutions below