我正在使用适用于Mac的Xamarin Studio Community 6开发Rhino插件。我想测试一些我的类,因此我安装了NUnit 3.5.0。
但是,即使最基本的测试用例不需要任何Rhino类,当我使用菜单运行>时,我得到System.IO.FileNotFoundException
。运行单元测试。
为什么要尝试加载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