유닛 테스트에서 세트를 얻었습니다 (resharper를 사용하여 모두 실행하면이 오류가 발생 함)전체 실행시 유닛 테스트가 실패했습니다 - API 제한 : 어셈블리가 이미 다른 위치에서로드되었습니다
SetUp : System.TypeInitializationException : The type initializer for 'FakeItEasy.Core.FakeScope' threw an exception. ----> System.IO.FileLoadException : API restriction: The assembly 'file:///C:\Users\abrown\Documents\Repos\ink.services.jetstar\My.Namespace.Tests.Unit\bin\Debug\My.Namespace.dll' has already loaded from a different location. It cannot be loaded from a new location within the same appdomain.
개별적으로 실행하면 통과합니다. 또한 아래 예외
는,이 같은 라인에 실패하는 것 :[SetUp]
public void SetUp()
{
_myFake = A.Fake<ISomething>();
편집
나는 '표준'NUnit과 테스트 러너를 사용하는 경우도 발생합니다. @ 데이비드 - 아르노으로
이 코멘트에, 완전성에 대한
(만 다시 선명 위해 명백하게)을 해결합니다 ReSharper에서 주자의 설정을 변경하여 말했다, 여기에 전체 스택 추적
입니다My.CompanyNamespace.ProjectName.Tests.Unit.DownloadAndStoreContentTests.gets_content_downloader_for_each_section_in_index: SetUp : System.TypeInitializationException : The type initializer for 'FakeItEasy.Core.FakeScope' threw an exception. ----> System.IO.FileLoadException : API restriction: The assembly 'file:///C:\Users\abrown\Documents\Repos\My.CompanyNamespace\My.CompanyNamespace.ProjectName.Tests.Unit\bin\Debug\My.CompanyNamespace.ProjectName.dll' has already loaded from a different location. It cannot be loaded from a new location within the same appdomain.
at FakeItEasy.Core.FakeScope.get_Current() at FakeItEasy.IoC.DictionaryContainer.<>c_DisplayClass1
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
1.b_0(DictionaryContainer c) at FakeItEasy.IoC.DictionaryContainer.Resolve(Type componentType) at FakeItEasy.ServiceLocator.ResolveT at 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) at FakeItEasy.IoC.DictionaryContainer.Resolve(Type componentType) at FakeItEasy.ServiceLocator.ResolveT at FakeItEasy.A.FakeT at My.CompanyNamespace.ProjectName.Tests.Unit.DownloadAndStoreContentTests.SetUp() in c:\Users\abrown\Documents\Repos\My.CompanyNamespace\My.CompanyNamespace.ProjectName.Tests.Unit\DownloadAndStoreContentTests.cs:line 23 --FileLoadException at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) at System.Reflection.RuntimeAssembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, Boolean suppressSecurityChecks, StackCrawlMark& stackMark) at System.Reflection.Assembly.ReflectionOnlyLoadFrom(String assemblyFile) at FakeItEasy.Core.ApplicationDirectoryAssembliesTypeCatalogue.GetAllAvailableAssemblies() at FakeItEasy.Core.ApplicationDirectoryAssembliesTypeCatalogue..ctor() at FakeItEasy.ImportsModule.b_1(DictionaryContainer c) at FakeItEasy.IoC.DictionaryContainer.SingletonResolver1.UnresolvedState.Resolve(DictionaryContainer container) at FakeItEasy.IoC.DictionaryContainer.<>c__DisplayClass1
1.b_0(DictionaryContainer c) at FakeItEasy.IoC.DictionaryContainer.Resolve(Type componentType) at FakeItEasy.ServiceLocator.ResolveT at FakeItEasy.ImportsModule.b_0(DictionaryContainer c) at FakeItEasy.IoC.DictionaryContainer.SingletonResolver1.UnresolvedState.Resolve(DictionaryContainer container) at FakeItEasy.IoC.DictionaryContainer.<>c__DisplayClass1
1.b_0(DictionaryContainer c) at FakeItEasy.IoC.DictionaryContainer.Resolve(Type componentType) at FakeItEasy.ServiceLocator.ResolveT at FakeItEasy.ImportsModule.b_4[T](DictionaryContainer c) at FakeItEasy.IoC.DictionaryContainer.SingletonResolver1.UnresolvedState.Resolve(DictionaryContainer container) at FakeItEasy.IoC.DictionaryContainer.<>c__DisplayClass1
1.b__0(DictionaryContainer c) at FakeItEasy.IoC.DictionaryContainer.Resolve(Type componentType) at FakeItEasy.ServiceLocator.ResolveT at FakeItEasy.Core.FakeScope.RootScope..ctor() at FakeItEasy.Core.FakeScope..cctor()
모의 테스트를 시작하기 전에 원본 어셈블리를로드하는 것과 같은 테스트를하는 것 같습니다. – SLaks
어디에서 그렇게 할 수 있습니까? – Alex
나는 잘 모른다. 코드를 자세히 읽어보십시오. – SLaks