2

I've created a Testproject for my Windows 8.1 Class Library. In the TestInitialize function a like to fake a Service.

A.Fake<IService>();

But I get this exception:

The type initializer for 'FakeItEasy.Core.FakeScope' threw an exception.
"Could not load file or assembly 'System.Core, Version=5.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e'
or one of its dependencies. The system cannot find the file specified.":
"System.Core, Version=5.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e"
       at FakeItEasy.Core.FakeScope.get_Current()
       at FakeItEasy.RootModule.<RegisterDependencies>b__2(DictionaryContainer c)
       at FakeItEasy.IoC.DictionaryContainer.<>c__DisplayClass1`1.<Register>b__0(DictionaryContainer c)
       at FakeItEasy.IoC.DictionaryContainer.Resolve(Type componentType)
       at FakeItEasy.ServiceLocator.Resolve[T]()
       at FakeItEasy.RootModule.<RegisterDependencies>b__3(DictionaryContainer c)
       at FakeItEasy.IoC.DictionaryContainer.<>c__DisplayClass1`1.<Register>b__0(DictionaryContainer c)
       at FakeItEasy.IoC.DictionaryContainer.Resolve(Type componentType)
       at FakeItEasy.ServiceLocator.Resolve[T]()
       at FakeItEasy.RootModule.<RegisterDependencies>b__18(DictionaryContainer c)
       at FakeItEasy.IoC.DictionaryContainer.<>c__DisplayClass1`1.<Register>b__0(DictionaryContainer c)
       at FakeItEasy.IoC.DictionaryContainer.Resolve(Type componentType)
       at FakeItEasy.ServiceLocator.Resolve[T]()
       at FakeItEasy.RootModule.<RegisterDependencies>b__17(DictionaryContainer c)
       at FakeItEasy.IoC.DictionaryContainer.<>c__DisplayClass1`1.<Register>b__0(DictionaryContainer c)
       at FakeItEasy.IoC.DictionaryContainer.Resolve(Type componentType)
       at FakeItEasy.ServiceLocator.Resolve[T]()
       at FakeItEasy.A.get_FakeCreator()
       at FakeItEasy.A.Fake[T]()

When I try the same but using NUnit instead of MS-Test everthing work fine.

What do I need to change that FakeItEasy is working with MS-Test?

I'm using FakeItEasy 1.23.0.0

Blair Conrad
  • 233,004
  • 25
  • 132
  • 111
Dani
  • 971
  • 12
  • 31

1 Answers1

1

I don't have Win8 or use Silverlight, so this is going to be a bit of a shot in the dark, but it may point you in the right direction.

The FakeItEasy win8 support is delivered using the same DLL we build for Silverlight.

I see that some people have had problems with Silverlight-using tests and MSTest and System.Core 5.0.5.0. To that end, perhaps looking at Why System.Core fails to load when adding Coded UI support for Silverlight 5 application?, specifically the comment by @Hans Passant that points at the Coded UI testing support for Silverlight blog post, may help.

Or it may not. Of course, Windows 8 Store support is experimental, and there have been reports of problems with 8.1 projects. So you may still be left high and dry.

Community
  • 1
  • 1
Blair Conrad
  • 233,004
  • 25
  • 132
  • 111