在tfs中使用Moq测试失败xUnit

时间:2017-10-10 08:27:08

标签: tfs moq xunit castle

我有三个使用Xunit 2.3.0编写的测试,我使用使用Castle.Core 4.2.0的Moq 4.7.137模拟了一些服务。 我的测试在我的本地工作区中正常运行,但在Team Foundation Server 2015中,它们失败并出现以下错误:

2017-10-10T08:20:44.7293310Z Information: [xUnit.net 00:00:22.8448542]       System.AggregateException : One or more errors occurred.

2017-10-10T08:20:44.7293310Z Information: [xUnit.net 00:00:22.8457824]       ---- System.MissingMethodException : Method not found: 'Boolean Castle.DynamicProxy.ProxyUtil.IsAccessible(System.Reflection.MethodBase, System.String ByRef)'.

2017-10-10T08:20:44.7293310Z Information: [xUnit.net 00:00:22.8466110]       ---- The following constructor parameters did not have matching fixture data: LoanFixture fixture

2017-10-10T08:20:44.7449508Z Information: [xUnit.net 00:00:22.8598342]       Stack Trace:

2017-10-10T08:20:44.7449508Z Information: [xUnit.net 00:00:22.8607783]         

2017-10-10T08:20:44.7449508Z Information: [xUnit.net 00:00:22.8615987]         ----- Inner Stack Trace #1 (System.MissingMethodException) -----

2017-10-10T08:20:44.7449508Z Information: [xUnit.net 00:00:22.8624251]            at Moq.Proxy.CastleProxyFactory.IsMethodVisible(MethodInfo method, String& messageIfNotVisible)

2017-10-10T08:20:44.7605671Z Information: [xUnit.net 00:00:22.8632101]         C:\projects\moq4\Source\Mock.cs(811,0): at Moq.Mock.ThrowIfSetupMethodNotVisibleToProxyFactory(MethodInfo method)

2017-10-10T08:20:44.7605671Z Information: [xUnit.net 00:00:22.8640470]         C:\projects\moq4\Source\Mock.cs(439,0): at Moq.Mock.<>c__DisplayClass62_0`1.<Setup>b__0()

2017-10-10T08:20:44.7605671Z Information: [xUnit.net 00:00:22.8648863]         C:\projects\moq4\Source\PexProtector.cs(61,0): at Moq.PexProtector.Invoke[T](Func`1 function)

2017-10-10T08:20:44.7605671Z Information: [xUnit.net 00:00:22.8656833]         C:\projects\moq4\Source\Mock.cs(432,0): at Moq.Mock.Setup[T](Mock`1 mock, Expression`1 expression, Condition condition)

2017-10-10T08:20:44.7605671Z Information: [xUnit.net 00:00:22.8664444]         C:\projects\moq4\Source\Mock.Generic.cs(263,0): at Moq.Mock`1.Setup(Expression`1 expression)

2017-10-10T08:20:44.7605671Z Information: [xUnit.net 00:00:22.8672662]         s\Banking\Banking.LoanManagement.Domain.Tests\Core\LoanFixture.cs(98,0): at Banking.LoanManagement.Domain.Tests.Core.LoanFixture.Initialize()

2017-10-10T08:20:44.7605671Z Information: [xUnit.net 00:00:22.8680978]         s\Banking\Banking.LoanManagement.Domain.Tests\Core\LoanFixture.cs(36,0): at Banking.LoanManagement.Domain.Tests.Core.LoanFixture..ctor()

2017-10-10T08:20:44.7605671Z Information: [xUnit.net 00:00:22.8688788]         ----- Inner Stack Trace #2 (Xunit.Sdk.TestClassException) -----

2017-10-10T08:20:44.7605671Z Information: [xUnit.net 00:00:22.8696267]    

我已经检查了所有相关的包裹。 我还在tfs测试任务上设置了测试运行器。但我无法解决这个问题

1 个答案:

答案 0 :(得分:0)

这是一个古老的问题,我忘了回答。在这种情况下,该问题与先前版本中的specflow错误有关,然后已得到解决。