我已经为我的Windows 8.1类库创建了一个Testproject。在TestInitialize函数中,一个用来伪造服务的like。
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
发布于 2014-08-12 20:30:58
我没有Win8,也没有使用Silverlight,所以这可能有点胡乱操作,但它可能会给你指明正确的方向。
Silverlight win8支持使用的DLL与我们为Silverlight构建的DLL相同。
我发现有些人在使用Silverlight时遇到了问题--使用测试、MSTest和System.Core 5.0.5.0。为此,也许可以看看Why System.Core fails to load when adding Coded UI support for Silverlight 5 application?,特别是@Hans Passant指向Coded UI testing support for Silverlight博客文章的评论,可能会有所帮助。
也可能不是。当然是Windows 8 Store support is experimental,也有关于8.1项目问题的报道。所以你可能还是孤立无援。
https://stackoverflow.com/questions/25260457
复制相似问题