【问题标题】:Winrt Testproject using FakeItEasy使用 FakeItEasy 的 Winrt 测试项目
【发布时间】: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


    【解决方案1】:

    我没有 Win8 或使用 Silverlight,所以这将是在黑暗中拍摄的一个小镜头,但它可能会为您指明正确的方向。

    使用我们为 Silverlight 构建的相同 DLL 提供 FakeItEasy win8 支持。

    我看到有些人在使用 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项目出现问题的报告。因此,您可能仍然处于高位和干燥状态。

    【讨论】:

      猜你喜欢
      • 2021-01-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-05-06
      相关资源
      最近更新 更多