単体テストのセットを持っていますが、(resharper を使用して) 一緒に実行すると、次のエラーが発生します。
セットアップ: System.TypeInitializationException: 'FakeItEasy.Core.FakeScope' の型初期化子が例外をスローしました。----> System.IO.FileLoadException : API 制限: アセンブリ 'file:///C:\Users\abrown\Documents\Repos\ink.services.jetstar\My.Namespace.Tests.Unit\bin\Debug \My.Namespace.dll' は、別の場所から既に読み込まれています。同じ appdomain 内の新しい場所からロードすることはできません。
それらを個別に実行すると、合格します。
例外のさらに下では、次のような行で失敗しています。
[SetUp]
public void SetUp()
{
_myFake = A.Fake<ISomething>();
編集
これは、「標準」の NUnit テスト ランナーを使用した場合にも発生します。
@david-arno がコメントで述べたように、ReSharper ランナーの設定を変更することで修正されます (明らかに re-sharper のみ)。
完全を期すために、ここに完全なスタック トレースがあります
My.CompanyNamespace.ProjectName.Tests.Unit.DownloadAndStoreContentTests.gets_content_downloader_for_each_section_in_index: セットアップ: System.TypeInitializationException: 'FakeItEasy.Core.FakeScope' の型初期化子が例外をスローしました。----> System.IO.FileLoadException : API 制限: アセンブリ 'file:///C:\Users\abrown\Documents\Repos\My.CompanyNamespace\My.CompanyNamespace.ProjectName.Tests.Unit\bin\Debug \My.CompanyNamespace.ProjectName.dll' は、別の場所から既に読み込まれています。同じ appdomain 内の新しい場所からロードすることはできません。
FakeItEasy.Core.FakeScope.get_Current() で FakeItEasy.IoC.DictionaryContainer.<>c_ DisplayClass1 1.b _0
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
( DictionaryContainer c) で FakeItEasy.IoC.DictionaryContainer.Resolve(Type componentType) で FakeItEasy.ServiceLocator.ResolveT で FakeItEasy. RootModule.b_1a (DictionaryContainer c) at FakeItEasy.IoC.DictionaryContainer.<>c _DisplayClass11.<Register>b__0(DictionaryContainer c) at FakeItEasy.IoC.DictionaryContainer.Resolve(Type componentType) at FakeItEasy.ServiceLocator.Resolve[T]() at FakeItEasy.RootModule.<RegisterDependencies>b__19(DictionaryContainer c) at FakeItEasy.IoC.DictionaryContainer.<>c__DisplayClass1
1.b__0(DictionaryContainer c) で FakeItEasy.IoC.DictionaryContainer.Resolve(Type componentType) で FakeItEasy.ServiceLocator.ResolveT で FakeItEasy.A.FakeT で My.CompanyNamespace.ProjectName.Tests.Unit.DownloadAndStoreContentTests.SetUp() で c: \Users\abrown\Documents\Repos\My.CompanyNamespace\My.CompanyNamespace.ProjectName.Tests.Unit\DownloadAndStoreContentTests.cs:23 行目 -- System.Reflection.RuntimeAssembly での FileLoadException。System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef、Evidence assemblySecurity、RuntimeAssembly reqAssembly、StackCrawl、StackCrawlMark&stackMark、IntPtr pPrivHostBinder、Boolean throwOnFileNotFound、Boolean forIntrospection、Boolean suppressSecurityChecks) System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef、Evidence assemblySecurity、RuntimeAssembly reqAssembly、StackCrawlMark& stackMark、Boolean throwOnFileNotFound、Boolean forIntrospection、Boolean suppressSecurityChecks) での IntPtr pPrivHostBinder、Boolean throwOnFileNotFound、Boolean forIntrospection、Boolean suppressSecurityChecks)FakeItEasy.Core.ApplicationDirectoryAssembliesTypeCatalogue.GetAllAvailableAssemblies() の System.Reflection.Assembly.ReflectionOnlyLoadFrom(String assemblyFile) の InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, Boolean suppressSecurityChecks, StackCrawlMark& stackMark)。 FakeItEasy.ImportsModule.b の Core.ApplicationDirectoryAssembliesTypeCatalogue..ctor()FakeItEasy.Core.ApplicationDirectoryAssembliesTypeCatalogue..ctor() の GetAllAvailableAssemblies() FakeItEasy.ImportsModule.b のFakeItEasy.Core.ApplicationDirectoryAssembliesTypeCatalogue..ctor() の GetAllAvailableAssemblies() FakeItEasy.ImportsModule.b の_1(DictionaryContainer c) FakeItEasy.IoC.DictionaryContainer.SingletonResolver1.UnresolvedState.Resolve(DictionaryContainer container) at FakeItEasy.IoC.DictionaryContainer.<>c__DisplayClass1
1.b_ 0(DictionaryContainer c) FakeItEasy.IoC.DictionaryContainer.Resolve(Type componentType) で FakeItEasy.ServiceLocator.ResolveT で FakeItEasy.ImportsModule.b _0(DictionaryContainer c) FakeItEasy.IoC.DictionaryContainer.SingletonResolver1.UnresolvedState.Resolve(DictionaryContainer container) at FakeItEasy.IoC.DictionaryContainer.<>c__DisplayClass1
1.b_ 0(DictionaryContainer c) で FakeItEasy.IoC.DictionaryContainer.Resolve(Type componentType) で FakeItEasy.ServiceLocator.ResolveT で FakeItEasy.ImportsModule.b _4[T](DictionaryContainer c) で FakeItEasy. .IoC.DictionaryContainer.SingletonResolver1.UnresolvedState.Resolve(DictionaryContainer container) at FakeItEasy.IoC.DictionaryContainer.<>c__DisplayClass1
1.b__0(DictionaryContainer c) FakeItEasy.IoC.DictionaryContainer.Resolve(Type componentType) で FakeItEasy.ServiceLocator.ResolveT で FakeItEasy.Core.FakeScope.RootScope..ctor() で FakeItEasy.Core.FakeScope..cctor()