0

NUnit と標準コンソール (GUI または非 GUI) ランナーを使用して Windows Phone 7.1 クラス ライブラリをテストしようとしています。

以下に関連する私の問題の後、私はこれを見つけました: http://dotneteers.net/blogs/vbandi/archive/2012/08/08/using-nunit-to-test-windows-phone-7-applications-part- 1.aspx

したがって、これは私自身のばかげた問題であるとほぼ確信しています。

アセンブリ テストを読み込もうとするたびに、次のエラーが発生します。

System.TypeLoadException: アセンブリ 'mscorlib、バージョン = 2.0.0.0、カルチャ = ニュートラル、PublicKeyToken = b77a5c561934e089' から型 'System.Runtime.Versioning.TargetFrameworkAttribute' を読み込めません。

詳細については、[例外の詳細] メニュー項目を使用してください。

※「詳細」はこちら※

System.TypeLoadException...

サーバースタックトレース: System.ModuleHandle.ResolveType(Int32 typeToken, RuntimeTypeHandle* typeInstArgs, Int32 typeInstCount, RuntimeTypeHandle* methodInstArgs, Int32 methodInstCount) System.ModuleHandle.ResolveTypeHandle(Int32 typeToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext) System .Reflection.Module.ResolveType(Int32 metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments) System.Reflection.CustomAttribute.FilterCustomAttributeRecord(CustomAttributeRecord caRecord, MetadataImport スコープ, Assembly& lastAptcaOkAssembly, Module decorModule, MetadataToken decorToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, Object[] 属性、IList 派生属性、RuntimeType& attributeType、RuntimeMethodHandle& ctor, Boolean& ctorHasParameters, Boolean& isVarArg) System.Reflection.CustomAttribute.GetCustomAttributes(Module decorModule, Int32 decorMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList generatedAttributes) System.Reflection.CustomAttribute.GetCustomAttributes(Assembly assembly, RuntimeType caType) ) ja System.Reflection.Assembly.GetCustomAttributes(Type attributeType, Boolean inherit) ja NUnit.Core.ActionsHelper.GetActionsFromAttributeProvider(ICustomAttributeProvider attributeProvider) ja NUnit.Core.TestAssembly..ctor(アセンブリ アセンブリ, 文字列パス) ja NUnit.Core.Builders .TestAssemblyBuilder.BuildTestAssembly(アセ​​ンブリ アセンブリ、String assemblyName、IList フィクスチャ、Boolean autoSuites)ctorHasParameters, Boolean& isVarArg) System.Reflection.CustomAttribute.GetCustomAttributes(Module decorModule, Int32 decorMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList generatedAttributes) System.Reflection.CustomAttribute.GetCustomAttributes(Assembly assembly, RuntimeType caType) System. Reflection.Assembly.GetCustomAttributes(Type attributeType, Boolean inherit) ja NUnit.Core.ActionsHelper.GetActionsFromAttributeProvider(ICustomAttributeProvider attributeProvider) ja NUnit.Core.TestAssembly..ctor(アセンブリ アセンブリ, 文字列パス) ja NUnit.Core.Builders.TestAssemblyBuilder.BuildTestAssembly (アセンブリ アセンブリ、文字列 assemblyName、IList フィクスチャ、ブール型 autoSuites)ctorHasParameters, Boolean& isVarArg) System.Reflection.CustomAttribute.GetCustomAttributes(Module decorModule, Int32 decorMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList generatedAttributes) System.Reflection.CustomAttribute.GetCustomAttributes(Assembly assembly, RuntimeType caType) System. Reflection.Assembly.GetCustomAttributes(Type attributeType, Boolean inherit) ja NUnit.Core.ActionsHelper.GetActionsFromAttributeProvider(ICustomAttributeProvider attributeProvider) ja NUnit.Core.TestAssembly..ctor(アセンブリ アセンブリ, 文字列パス) ja NUnit.Core.Builders.TestAssemblyBuilder.BuildTestAssembly (アセンブリ アセンブリ、文字列 assemblyName、IList フィクスチャ、ブール型 autoSuites)System.Reflection.CustomAttribute.GetCustomAttributes(Assembly assembly, RuntimeType caType) System.Reflection.Assembly.GetCustomAttributes(Type attributeType, Boolean) inherit) ja NUnit.Core.ActionsHelper.GetActionsFromAttributeProvider(ICustomAttributeProvider attributeProvider) ja NUnit.Core.TestAssembly..ctor(アセンブリ アセンブリ, 文字列パス) ja NUnit.Core.Builders.TestAssemblyBuilder.BuildTestAssembly(アセ​​ンブリ アセンブリ, 文字列 assemblyName, IList フィクスチャ,ブール型 autoSuite)System.Reflection.CustomAttribute.GetCustomAttributes(Assembly assembly, RuntimeType caType) System.Reflection.Assembly.GetCustomAttributes(Type attributeType, Boolean) inherit) ja NUnit.Core.ActionsHelper.GetActionsFromAttributeProvider(ICustomAttributeProvider attributeProvider) ja NUnit.Core.TestAssembly..ctor(アセンブリ アセンブリ, 文字列パス) ja NUnit.Core.Builders.TestAssemblyBuilder.BuildTestAssembly(アセ​​ンブリ アセンブリ, 文字列 assemblyName, IList フィクスチャ,ブール型 autoSuite)Boolean mustBeInheritable, IList derivedAttributes) ja System.Reflection.CustomAttribute.GetCustomAttributes(Assembly assembly, RuntimeType caType) ja System.Reflection.Assembly.GetCustomAttributes(Type attributeType, Boolean inherit) ja NUnit.Core.ActionsHelper.GetActionsFromAttributeProvider(ICustomAttributeProvider attributeProvider) ja NUnit .Core.TestAssembly..ctor(アセンブリ アセンブリ、文字列パス) ja NUnit.Core.Builders.TestAssemblyBuilder.BuildTestAssembly(アセ​​ンブリ アセンブリ、文字列 assemblyName、IList フィクスチャ、Boolean autoSuites)Boolean mustBeInheritable, IList derivedAttributes) ja System.Reflection.CustomAttribute.GetCustomAttributes(Assembly assembly, RuntimeType caType) ja System.Reflection.Assembly.GetCustomAttributes(Type attributeType, Boolean inherit) ja NUnit.Core.ActionsHelper.GetActionsFromAttributeProvider(ICustomAttributeProvider attributeProvider) ja NUnit .Core.TestAssembly..ctor(アセンブリ アセンブリ、文字列パス) ja NUnit.Core.Builders.TestAssemblyBuilder.BuildTestAssembly(アセ​​ンブリ アセンブリ、文字列 assemblyName、IList フィクスチャ、Boolean autoSuites)ActionsHelper.GetActionsFromAttributeProvider(ICustomAttributeProvider attributeProvider) ja NUnit.Core.TestAssembly..ctor(アセンブリ アセンブリ、文字列パス) ja NUnit.Core.Builders.TestAssemblyBuilder.BuildTestAssembly(アセ​​ンブリ アセンブリ、文字列 assemblyName、IList フィクスチャ、Boolean autoSuites)ActionsHelper.GetActionsFromAttributeProvider(ICustomAttributeProvider attributeProvider) ja NUnit.Core.TestAssembly..ctor(アセンブリ アセンブリ、文字列パス) ja NUnit.Core.Builders.TestAssemblyBuilder.BuildTestAssembly(アセ​​ンブリ アセンブリ、文字列 assemblyName、IList フィクスチャ、Boolean autoSuites)
NUnit.Core.Builders.TestAssemblyBuilder.Build(String assemblyName, Boolean autoSuites) en NUnit.Core.Builders.TestAssemblyBuilder.Build(String assemblyName, String testName, Boolean autoSuites) en NUnit.Core.TestSuiteBuilder.BuildSingleAssembly(TestPackage パッケージ)
NUnit.Core.TestSuiteBuilder.Build(TestPackage パッケージ) NUnit.Core.SimpleTestRunner.Load(TestPackage パッケージ) NUnit.Core.ProxyTestRunner.Load(TestPackage パッケージ) NUnit.Core.ProxyTestRunner.Load(TestPackage パッケージ) NUnit .Core.RemoteTestRunner.Load(TestPackage パッケージ) ja System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs) ja System.Runtime .Remoting.Messaging.StackBuilderSink.PrivateProcessMessage(RuntimeMethodHandle md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs) en System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg, Int32 methodPtr 、ブール値 fExecuteInContext)

[0] で例外が再スローされました。 TestRunner.Load(TestPackage パッケージ) ja NUnit.Util.TestDomain.Load(TestPackage パッケージ) ja NUnit.Util.TestLoader.LoadTest(String testName)

誰かが私が見つけられない問題を知っていますか?

4

1 に答える 1

0

私は(非常に簡単に説明できる方法で)何が問題で、何が解決策であるかを見つけました(または、代替案をより適切に言いました)。

問題は、NUnit コンソール ランナー (または GUI ランナー) が異なる環境で実行されることです。Console Applicationつまり、またはaを意味し、ライブラリWinforms applicationをロードしようとしますが、それが問題です。Windows Phone

解決策は、Re-Sharper、NCrunch、Visual NUnit などでテストを実行し、NUnit のデフォルト ランナーを使用しないことです。

Visual NUnit を使用しています。 http://visualstudiogallery.msdn.microsoft.com/c8164c71-0836-4471-80ce-633383031099

:-)

私の質問を読んでくれたすべての人に感謝します。

于 2012-10-21T19:38:44.503 に答える