1

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?

Satish
  • 3,020
  • 7
  • 35
  • 47
  • 1
    I figured this out. For unit test created in VS 2012 you should use VSTest.Console.exe to run tests instead of MSTest. VSTest.Console.exe is located in C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow – Satish Sep 03 '13 at 21:00

0 Answers0