1

我正在使用 Xamarin Studio Community 6 for Mac 开发 Rhino 插件。我想测试我的一些课程,因此我安装了 NUnit 3.5.0。但是,即使使用不需要任何 Rhino 类的最基本测试用例,System.IO.FileNotFoundException当我使用Menu Run > Run Unit Tests时,我也会得到一个。为什么它会尝试加载 Rhino 库?如何运行我的测试?

我的测试用例:

using NUnit.Framework;

namespace MyProject
{
    public class Tests
    {
        [Test]
        public void TestArithmetic()
        {
            Assert.Less(1, 1 + 1);
        }
    }
}

运行测试套件时的错误:

ERROR: System.IO.FileNotFoundException: Could not load file or assembly or one of its dependencies.
File name: 'RhinoCommon, Version=5.1.50000.0, Culture=neutral, PublicKeyToken=552281e97c755530'


Server stack trace: 
  at (wrapper managed-to-native) System.MonoCustomAttrs:GetCustomAttributesInternal (System.Reflection.ICustomAttributeProvider,System.Type,bool)
  at System.MonoCustomAttrs.GetCustomAttributesBase (System.Reflection.ICustomAttributeProvider obj, System.Type attributeType, System.Boolean inheritedOnly) [0x00019] in /private/tmp/source-mono-4.6.0-c8sr0/bockbuild-mono-4.6.0-branch-c8sr0/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/corlib/System/MonoCustomAttrs.cs:128 
  at System.MonoCustomAttrs.GetCustomAttributes (System.Reflection.ICustomAttributeProvider obj, System.Type attributeType, System.Boolean inherit) [0x00040] in /private/tmp/source-mono-4.6.0-c8sr0/bockbuild-mono-4.6.0-branch-c8sr0/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/corlib/System/MonoCustomAttrs.cs:158 
  at System.Reflection.Assembly.GetCustomAttributes (System.Type attributeType, System.Boolean inherit) [0x00000] in /private/tmp/source-mono-4.6.0-c8sr0/bockbuild-mono-4.6.0-branch-c8sr0/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/corlib/System.Reflection/Assembly.cs:252 
  at NUnit.Engine.Services.DomainManager+TargetFrameworkAgent.GetTargetFrameworkName (System.String assemblyPath) [0x0001f] in <7934713e6a5945a48b191c3250979bc9>:0 
  at (wrapper remoting-invoke-with-check) NUnit.Engine.Services.DomainManager+TargetFrameworkAgent:GetTargetFrameworkName (string)
  at (wrapper xdomain-dispatch) NUnit.Engine.Services.DomainManager+TargetFrameworkAgent:GetTargetFrameworkName (object,byte[]&,byte[]&,string)

Exception rethrown at [0]: 
  at (wrapper xdomain-invoke) NUnit.Engine.Services.DomainManager+TargetFrameworkAgent:GetTargetFrameworkName (string)
  at (wrapper remoting-invoke-with-check) NUnit.Engine.Services.DomainManager+TargetFrameworkAgent:GetTargetFrameworkName (string)
  at NUnit.Engine.Services.DomainManager.SetTargetFramework (System.String assemblyPath, System.AppDomainSetup setup) [0x00047] in <7934713e6a5945a48b191c3250979bc9>:0 
  at NUnit.Engine.Services.DomainManager.CreateAppDomainSetup (NUnit.Engine.TestPackage package) [0x00077] in <7934713e6a5945a48b191c3250979bc9>:0 
  at NUnit.Engine.Services.DomainManager.CreateDomain (NUnit.Engine.TestPackage package) [0x00000] in <7934713e6a5945a48b191c3250979bc9>:0 
  at NUnit.Engine.Runners.TestDomainRunner.LoadPackage () [0x0000d] in <7934713e6a5945a48b191c3250979bc9>:0 
  at NUnit.Engine.Runners.AbstractTestRunner.Load () [0x00000] in <7934713e6a5945a48b191c3250979bc9>:0 
  at NUnit.Engine.Runners.MasterTestRunner.LoadPackage () [0x0001d] in <7934713e6a5945a48b191c3250979bc9>:0 
  at NUnit.Engine.Runners.AbstractTestRunner.EnsurePackageIsLoaded () [0x00008] in <7934713e6a5945a48b191c3250979bc9>:0 
  at NUnit.Engine.Runners.AbstractTestRunner.Run (NUnit.Engine.ITestEventListener listener, NUnit.Engine.TestFilter filter) [0x00000] in <7934713e6a5945a48b191c3250979bc9>:0 
  at NUnit.Engine.Runners.MasterTestRunner.NUnit.Engine.ITestRunner.Run (NUnit.Engine.ITestEventListener listener, NUnit.Engine.TestFilter filter) [0x00000] in <7934713e6a5945a48b191c3250979bc9>:0 
  at NUnit3Runner.NUnitTestRunner.Run (NUnit.Engine.ITestEventListener listener, System.String[] nameFilter, System.String path, System.String suiteName, System.String[] supportAssemblies, System.String testRunnerType, System.String testRunnerAssembly) [0x000ae] in <05fea690f7d64d7ba8fba4e8fdbb8905>:0 
  at NUnit3Runner.NUnitTestRunner.Run (MonoDevelop.UnitTesting.NUnit.RunRequest r) [0x00075] in <05fea690f7d64d7ba8fba4e8fdbb8905>:0 
  at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
  at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00038] in /private/tmp/source-mono-4.6.0-c8sr0/bockbuild-mono-4.6.0-branch-c8sr0/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/corlib/System.Reflection/MonoMethod.cs:305 
System.IO.FileNotFoundException: Could not load file or assembly or one of its dependencies.
File name: 'RhinoCommon, Version=5.1.50000.0, Culture=neutral, PublicKeyToken=552281e97c755530'


Server stack trace: 
  at (wrapper managed-to-native) System.MonoCustomAttrs:GetCustomAttributesInternal (System.Reflection.ICustomAttributeProvider,System.Type,bool)
  at System.MonoCustomAttrs.GetCustomAttributesBase (System.Reflection.ICustomAttributeProvider obj, System.Type attributeType, System.Boolean inheritedOnly) [0x00019] in /private/tmp/source-mono-4.6.0-c8sr0/bockbuild-mono-4.6.0-branch-c8sr0/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/corlib/System/MonoCustomAttrs.cs:128 
  at System.MonoCustomAttrs.GetCustomAttributes (System.Reflection.ICustomAttributeProvider obj, System.Type attributeType, System.Boolean inherit) [0x00040] in /private/tmp/source-mono-4.6.0-c8sr0/bockbuild-mono-4.6.0-branch-c8sr0/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/corlib/System/MonoCustomAttrs.cs:158 
  at System.Reflection.Assembly.GetCustomAttributes (System.Type attributeType, System.Boolean inherit) [0x00000] in /private/tmp/source-mono-4.6.0-c8sr0/bockbuild-mono-4.6.0-branch-c8sr0/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/corlib/System.Reflection/Assembly.cs:252 
  at NUnit.Engine.Services.DomainManager+TargetFrameworkAgent.GetTargetFrameworkName (System.String assemblyPath) [0x0001f] in <7934713e6a5945a48b191c3250979bc9>:0 
  at (wrapper remoting-invoke-with-check) NUnit.Engine.Services.DomainManager+TargetFrameworkAgent:GetTargetFrameworkName (string)
  at (wrapper xdomain-dispatch) NUnit.Engine.Services.DomainManager+TargetFrameworkAgent:GetTargetFrameworkName (object,byte[]&,byte[]&,string)

Exception rethrown at [0]: 
  at (wrapper xdomain-invoke) NUnit.Engine.Services.DomainManager+TargetFrameworkAgent:GetTargetFrameworkName (string)
  at (wrapper remoting-invoke-with-check) NUnit.Engine.Services.DomainManager+TargetFrameworkAgent:GetTargetFrameworkName (string)
  at NUnit.Engine.Services.DomainManager.SetTargetFramework (System.String assemblyPath, System.AppDomainSetup setup) [0x00047] in <7934713e6a5945a48b191c3250979bc9>:0 
  at NUnit.Engine.Services.DomainManager.CreateAppDomainSetup (NUnit.Engine.TestPackage package) [0x00077] in <7934713e6a5945a48b191c3250979bc9>:0 
  at NUnit.Engine.Services.DomainManager.CreateDomain (NUnit.Engine.TestPackage package) [0x00000] in <7934713e6a5945a48b191c3250979bc9>:0 
  at NUnit.Engine.Runners.TestDomainRunner.LoadPackage () [0x0000d] in <7934713e6a5945a48b191c3250979bc9>:0 
  at NUnit.Engine.Runners.AbstractTestRunner.Load () [0x00000] in <7934713e6a5945a48b191c3250979bc9>:0 
  at NUnit.Engine.Runners.MasterTestRunner.LoadPackage () [0x0001d] in <7934713e6a5945a48b191c3250979bc9>:0 
  at NUnit.Engine.Runners.AbstractTestRunner.EnsurePackageIsLoaded () [0x00008] in <7934713e6a5945a48b191c3250979bc9>:0 
  at NUnit.Engine.Runners.AbstractTestRunner.Run (NUnit.Engine.ITestEventListener listener, NUnit.Engine.TestFilter filter) [0x00000] in <7934713e6a5945a48b191c3250979bc9>:0 
  at NUnit.Engine.Runners.MasterTestRunner.NUnit.Engine.ITestRunner.Run (NUnit.Engine.ITestEventListener listener, NUnit.Engine.TestFilter filter) [0x00000] in <7934713e6a5945a48b191c3250979bc9>:0 
  at NUnit3Runner.NUnitTestRunner.Run (NUnit.Engine.ITestEventListener listener, System.String[] nameFilter, System.String path, System.String suiteName, System.String[] supportAssemblies, System.String testRunnerType, System.String testRunnerAssembly) [0x000ae] in <05fea690f7d64d7ba8fba4e8fdbb8905>:0 
  at NUnit3Runner.NUnitTestRunner.Run (MonoDevelop.UnitTesting.NUnit.RunRequest r) [0x00075] in <05fea690f7d64d7ba8fba4e8fdbb8905>:0 
  at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
  at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00038] in /private/tmp/source-mono-4.6.0-c8sr0/bockbuild-mono-4.6.0-branch-c8sr0/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/corlib/System.Reflection/MonoMethod.cs:30

在不包含任何引用 Rhino 库的类的不同项目中,测试运行器为我工作(在菜单运行 -> 运行单元测试中)。

我使用 OSX 10.11、Rhinoceros 5.2.2、Xamarin Studio 6.1.1

4

0 回答 0