Castle.MicroKernel.ComponentActivator.ComponentActivatorException : ComponentActivator: could not instantiate Strix.Customs.Tests.Configuration.TestAppConfigurationAccessor
---- System.Reflection.TargetInvocationException : Exception has been thrown by the target of an invocation.
-------- System.IO.FileNotFoundException : The configuration file 'appsettings.json' was not found and is not optional.
appsettings.json is set to copy always.
Any ideas why none of the unit tests work?
4 Answer(s)
-
0
I know that it's failing in AppConfigurations.BuildConfiguration, but only in tests.
BuildConfiguration has no issues when it gets called from the TestModule PreInitialize method?
-
0
Hi @strix20,
Do you run unit tests using Visual Studio's test runner or any tool like Resharper ?
-
0
I tried both ReSharper and VS test runner.
It turned out to be an issue with shadow copying, and even with ReSharper set to not shadow copy, it still would.
I ended up having to create an xunit.runner.json in the test project and set shadowCopy: false, per this:
<a class="postlink" href="https://xunit.github.io/docs/configuring-with-json.html">https://xunit.github.io/docs/configuring-with-json.html</a>
-
0
Thanks for the feedback @strix20, it was hard to identify for us :).