【发布时间】:2014-08-12 20:30:58
【问题描述】:
我为我的 Windows 8.1 类库创建了一个 Testproject。 在 TestInitialize 函数中,类似于伪造服务。
A.Fake<IService>();
但我得到了这个例外:
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]()
当我尝试相同但使用 NUnit 而不是 MS-Test 时一切正常。
我需要改变 FakeItEasy 与 MS-Test 一起使用的情况吗?
我正在使用 FakeItEasy 1.23.0.0
【问题讨论】:
标签: c# .net windows-runtime mstest fakeiteasy